Submission #418426

#TimeUsernameProblemLanguageResultExecution timeMemory
418426iulia13Cave (IOI13_cave)C++14
100 / 100
317 ms568 KiB
#include <iostream> #include "cave.h" using namespace std; const int N = 5005; int s[N]; int fixat[N]; int button[N]; int door[N]; int S[N], D[N]; int nn; void exploreCave(int n) { int i; nn = n; for (int curr = 0; curr < n; curr++) { int key = 1; for (i = 0; i < n; i++) { if (fixat[i]) s[i] = fixat[i] - 1; else s[i] = 1; } if (tryCombination(s) == curr) { for (i = 0; i < n; i++) { if (fixat[i]) s[i] = fixat[i] - 1; else s[i] = 0; } key = 0; } int st = 0, dr = n - 1; while(st <= dr) { if (st == dr) { fixat[st] = s[st] + 1; button[st] = s[st]; door[st] = curr; break; } int mid = (st + dr) / 2; for (i = st; i <= mid; i++) if (!fixat[i]) s[i] = 1 - key; if (tryCombination(s) == curr) { for (i = st; i <= mid; i++) if (!fixat[i]) s[i] = key; dr = mid; } else st = mid + 1; } } answer(button, door); }
#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...