Submission #303907

#TimeUsernameProblemLanguageResultExecution timeMemory
303907rocks03Cave (IOI13_cave)C++14
0 / 100
2 ms384 KiB
#include "cave.h" #include<bits/stdc++.h> using namespace std; mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); void answer(int S[], int D[]); int tryCombination(int S[]); void exploreCave(int N){ int ans[N], d[N]; for(int i = 0; i < N; i++){ ans[i] = rng() % 2; } memset(d, -1, sizeof(d)); vector<int> mn(N, 0); int res = tryCombination(ans); while(res != -1){ for(int i = 0; i < N; i++){ if(d[i] != -1 || mn[i] > res){ continue; } ans[i] ^= 1; int res2 = tryCombination(ans); if(res2 == -1){ res = res2; break; } if(res2 < res){ ans[i] ^= 1; d[i] = res2; } else if(res == res2){ mn[i] = res; continue; } else if(res > res2){ d[i] = res; res = res2; } } } for(int i = 0; i < N; i++){ if(d[i] == -1){ ans[i] ^= 1; d[i] = tryCombination(ans); ans[i] ^= 1; } } answer(ans, d); }
#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...