fork download
  1. // ~~ icebear ~~
  2. #include <bits/stdc++.h>
  3. using namespace std;
  4. #define int long long
  5. typedef long long ll;
  6. typedef pair<int, int> ii;
  7. typedef pair<int, ii> iii;
  8.  
  9. template<class T>
  10. bool minimize(T &a, const T &b) {
  11. if (a > b) return a = b, true;
  12. return false;
  13. }
  14.  
  15. template<class T>
  16. bool maximize(T &a, const T &b) {
  17. if (a < b) return a = b, true;
  18. return false;
  19. }
  20.  
  21. #define FOR(i,a,b) for(int i=(a); i<=(b); ++i)
  22. #define FORR(i,a,b) for(int i=(a); i>=(b); --i)
  23. #define REP(i, n) for(int i=0; i<(n); ++i)
  24. #define RED(i, n) for(int i=(n)-1; i>=0; --i)
  25. #define MASK(i) (1LL << (i))
  26. #define BIT(S, i) (((S) >> (i)) & 1)
  27. #define mp make_pair
  28. #define pb push_back
  29. #define fi first
  30. #define se second
  31. #define all(x) x.begin(), x.end()
  32. #define task "icebear"
  33.  
  34. const int MOD = 1e9 + 7;
  35. const int inf = 1e9 + 27092008;
  36. const ll INF = 1e18 + 27092008;
  37. const int N = 2e5 + 5;
  38.  
  39. mt19937_64 rd(chrono::steady_clock::now().time_since_epoch().count());
  40. int random(int L, int R) {
  41. return L + rd() % (R - L + 1);
  42. }
  43.  
  44. vector<int> G[N];
  45. int t;
  46. bool vis[N];
  47. void dfs(int u, int s) {
  48. if (u != s) t = u;
  49. vis[u] = true;
  50. for(int v : G[u]) if (!vis[v]) dfs(v, s);
  51. }
  52.  
  53. void gen(int i) {
  54. ofstream cout("gen.inp");
  55. int n = random(1, 1000), q = random(1, 1000);
  56. cout << n << ' ' << q << '\n';
  57. FOR(i, 1, q){
  58. int t = random(1, 2);
  59. if (t == 1) {
  60. int l = random(1, n);
  61. int r = random(1, n);
  62. cout << t << ' ' << l << ' ' << r << ' ' << random(1, 1000) << "\n";
  63. } else {
  64. int l = random(1, n);
  65. int r = random(1, n);
  66. cout << t << ' ' << l << ' ' << r << '\n';
  67. }
  68. }
  69. cout.close();
  70. }
  71.  
  72. void process(void) {
  73. FOR(i, 1, 50) {
  74. gen(i);
  75.  
  76. system("task.exe");
  77. system("task_trau.exe");
  78.  
  79. cout << "#Test " << i << ": ";
  80. if (system("fc gen.out gen.ans")) {
  81. cout << "WRONG!\n";
  82. exit(0);
  83. } else cout << "PASS!\n";
  84. }
  85. }
  86.  
  87. signed main() {
  88. ios_base::sync_with_stdio(0);
  89. cin.tie(0); cout.tie(0);
  90. if (fopen(task".inp", "r")) {
  91. freopen(task".inp", "r", stdin);
  92. freopen(task".out", "w", stdout);
  93. }
  94. int tc = 1;
  95. // cin >> tc;
  96. while(tc--) {
  97. process();
  98. }
  99. return 0;
  100. }
  101.  
Success #stdin #stdout #stderr 0.01s 8428KB
stdin
Standard input is empty
stdout
#Test 1: WRONG!
stderr
sh: 1: task.exe: not found
sh: 1: task_trau.exe: not found
sh: 1: fc: not found