Submission #857482

#TimeUsernameProblemLanguageResultExecution timeMemory
857482chilinhxyzabcCave (IOI13_cave)C++17
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] = 1; d[i] = -1; } int curDoor = tryCombination(s); int l = 0, r = n - 1, res = n - 1; if(curDoor != -1) { for(int i = n - 1; i >= 0; i--) { s[i] = 1 - s[i]; if(tryCombination(s) == curDoor) { s[i] = 1 - s[i]; l = i; break; } else { s[i] = 1 - s[i]; } } } while(curDoor != -1) { while(l <= r) { int m = (l + r) / 2; s[m] = 1 - s[m]; int door = tryCombination(s); if(door == curDoor) { r = m - 1; } else { res = m; l = m + 1; } s[m] = 1 - s[m]; } d[res] = curDoor; s[res] = 1 - s[res]; curDoor = tryCombination(s); l = res + 1, r = n - 1; } for(int i = 0; i < n; i++) { if(d[i] != -1) continue; s[i] = 1 - s[i]; int door = tryCombination(s); d[i] = door; s[i] = 1 - s[i]; } 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...