Submission #303888

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