Submission #637038

#TimeUsernameProblemLanguageResultExecution timeMemory
637038bonkCave (IOI13_cave)C++14
100 / 100
929 ms460 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; void exploreCave(int n){ int s[n], d[n]; vector<bool>mark(n); for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++) if(!mark[j]) s[j] = 0; int x = tryCombination(s); if(x == i){ for(int j = 0; j < n; j++) if(!mark[j]) s[j] = 1; } int l = 0, r = n - 1; int a = 0; while(l <= r){ int mid = (l + r)/2; for(int j = 0; j < mid; j++) if(!mark[j]) s[j] ^= 1; int tmp = tryCombination(s); if(tmp == -1) tmp = n + 1; if(tmp > i){ a = mid; l = mid + 1; } else{ r = mid - 1; } for(int j = 0; j < mid; j++) if(!mark[j]) s[j] ^= 1; } mark[a] = true; d[a] = 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...