Submission #970614

#TimeUsernameProblemLanguageResultExecution timeMemory
970614AcanikolicCave (IOI13_cave)C++14
0 / 100
1 ms348 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; void exploreCave(int N) { int S[N],D[N]; for(int i = 0; i < N; i++) { S[i] = 0; D[i] = -1; } for(int k = 0; k < N; k++) { int index = tryCombination(S); if(index == -1) break; int l = 0,r = N - 1,ans = 0; while(l <= r) { int mid = (l + r) / 2; S[mid] ^= 1; if(tryCombination(S) > index || tryCombination(S) == -1) { ans = mid; S[mid] ^= 1; break; } S[mid] ^= 1; if(tryCombination(S) == index) { l = mid + 1; }else { r = mid - 1; } } S[ans] ^= 1; D[ans] = index; } int SS[N]; for(int i = 0; i < N; i++) { SS[i] = 1; } for(int i = 0; i < N; i++) if(D[i] != -1) SS[i] = S[i]; for(int k = 0; k < N; k++) { int index = tryCombination(SS); if(index == -1) break; int l = 0,r = N - 1,ans = 0; while(l <= r) { int mid = (l + r) / 2; SS[mid] ^= 1; if(tryCombination(SS) > index || tryCombination(SS) == -1) { ans = mid; SS[mid] ^= 1; break; } SS[mid] ^= 1; if(tryCombination(SS) == index) { l = mid + 1; }else { r = mid - 1; } } SS[ans] ^= 1; D[ans] = index; } answer(S,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...