Submission #239217

#TimeUsernameProblemLanguageResultExecution timeMemory
239217osaaateiasavtnlTeleporters (IOI08_teleporters)C++14
0 / 100
903 ms7748 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define ii pair <int, int> #define app push_back #define all(a) a.begin(), a.end() #define bp __builtin_popcount #define ll long long #define mp make_pair #define f first #define s second #define Time (double)clock()/CLOCKS_PER_SEC #define str to_string mt19937 rnd(228); const int TEST = 10000; string read(string name) { string ans; string line; ifstream t(name); while (getline(t, line)) ans += line + '\n'; return ans; } /* const int C = 3; string genstring(int n) { string ans; for (int i = 0; i < n; ++i) { ans += (char)('a' + rnd() % C); } return ans; } */ string tree(int n) { string ans; for (int i = 1; i < n; ++i) { ans += to_string(rnd() % i + 1) + ' ' + to_string(i + 1) + '\n'; } return ans; } string perm(int n) { string ans; vector <int> p(n); for (int i = 0; i < n; ++i) p[i] = i; shuffle(p.begin(), p.end(), rnd); for (int e : p) ans += str(e + 1) + ' '; return ans; } int lcm(int a, int b) { return a * b / __gcd(a, b); } string gen() { string test; int t = 1; while (t--) { int n = rnd() % 3 + 1; int m = rnd() % 2 + 1; test += str(n) + ' ' + str(m) + '\n'; vector <int> c; for (int i = 1; i <= 2 * n; ++i) c.app(i); shuffle(all(c), rnd); for (int i = 0; i < n; ++i) { int l = c[2 * i]; int r = c[2 * i + 1]; if (r < l) swap(l, r); test += str(l) + ' ' + str(r) + '\n'; } } return test; } signed main() { ofstream ans("test.txt"); system("g++ -O2 -std=gnu++17 main.cpp -o main.exe"); system("g++ -O2 -std=gnu++17 brute.cpp -o brute.exe"); for (int i = 0; i < TEST; ++i) { string test = gen(); ofstream newtest("newtest.txt"); newtest << test; newtest.close(); system("main.exe < newtest.txt > out1.txt"); system("brute.exe < newtest.txt > out2.txt"); string ans1 = read("out1.txt"); string ans2 = read("out2.txt"); if (ans1 != ans2 && ans1 + '\n' != ans2 && ans2 + '\n' != ans1) { ans << test; ans.close(); exit(0); } cout << i << '\n'; } cout << "NOT FOUND\n"; ans.close(); return 0; }

Compilation message (stderr)

teleporters.cpp: In function 'int main()':
teleporters.cpp:92:11: warning: ignoring return value of 'int system(const char*)', declared with attribute warn_unused_result [-Wunused-result]
     system("g++ -O2 -std=gnu++17 main.cpp -o main.exe");
     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
teleporters.cpp:93:11: warning: ignoring return value of 'int system(const char*)', declared with attribute warn_unused_result [-Wunused-result]
     system("g++ -O2 -std=gnu++17 brute.cpp -o brute.exe");
     ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
teleporters.cpp:102:15: warning: ignoring return value of 'int system(const char*)', declared with attribute warn_unused_result [-Wunused-result]
         system("main.exe < newtest.txt > out1.txt");
         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
teleporters.cpp:103:15: warning: ignoring return value of 'int system(const char*)', declared with attribute warn_unused_result [-Wunused-result]
         system("brute.exe < newtest.txt > out2.txt");
         ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...