fork download
  1. #include "bits/stdc++.h"
  2.  
  3. using namespace std;
  4.  
  5. class Random {
  6. public:
  7. Random() = default;
  8.  
  9. Random(std::mt19937::result_type seed) : eng(seed) {}
  10.  
  11. long long DrawNumber(long long min, long long max);
  12.  
  13. private:
  14. std::mt19937 eng{std::random_device{}()};
  15. };
  16.  
  17. long long Random::DrawNumber(long long min, long long max) {
  18. if (max < min)return 0;
  19. return std::uniform_int_distribution<long long>{min, max}(eng);
  20. }
  21.  
  22.  
  23. Random rnd(0);
  24.  
  25. void generate() {
  26. ofstream cout("test.in");
  27. int n = rnd.DrawNumber(1, 4);
  28. while (n--) {cout<<"AB"[rnd.DrawNumber(0, 1)];}
  29. cout << endl;
  30. cout.close();
  31. }
  32. int main() {
  33. system("g++ -lm -O3 -std=c++17 -DLOCAL -pipe -o /wa.exe ./main.cpp");
  34. system("g++ -lm -O3 -std=c++17 -pipe -o /ac.exe ./ac.cpp");
  35. // system("javac Main.java");
  36. int tc = 1;
  37. while (1) {
  38. cerr << "Case " << tc++ << " ";
  39. generate();
  40. clock_t bef=clock();
  41. system("ac.exe <test.in >ac.txt");
  42. clock_t bet=clock();
  43. cerr<<(bet-bef-0.0)/CLOCKS_PER_SEC<<" ";
  44. if (system("wa.exe <test.in >wa.txt"))break;
  45. clock_t aft=clock();
  46. cerr<<(aft-bet-0.0)/CLOCKS_PER_SEC<<endl;
  47.  
  48. //if (system("java Main <test.in >wa.txt"))break;
  49.  
  50. // cerr << tc++ << endl;
  51. ifstream acs("ac.txt");
  52. ifstream was("wa.txt");
  53.  
  54. string ac, wa;
  55. getline(was, wa, (char) EOF);
  56.  
  57. getline(acs, ac, (char) EOF);
  58. was.close();
  59.  
  60. acs.close();
  61.  
  62. // cout << ac << endl;
  63. // cout << wa << endl;
  64. //if (ac !="YES\n")
  65. if (ac != wa)
  66. break;
  67. }
  68. }
  69.  
Success #stdin #stdout #stderr 0.01s 5320KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
g++: error: ./main.cpp: No such file or directory
g++: error: ./ac.cpp: No such file or directory
Case 1 sh: 1: cannot open test.in: No such file
sh: 1: ac.exe: not found
5.6e-05 sh: 1: cannot open test.in: No such file
sh: 1: wa.exe: not found