Submission #672745

#TimeUsernameProblemLanguageResultExecution timeMemory
672745Hacv16Cave (IOI13_cave)C++17
0 / 100
41 ms628 KiB
#include<bits/stdc++.h> #include "cave.h" using namespace std; typedef long long ll; const int MAX = 5e3 + 15; const int INF = 0x3f3f3f3f; bool mark[MAX]; void exploreCave(int n){ int S[n] = { 0 }, D[n] = { 0 }; for(int door = 0; door < n; door++){ for(int i = 0; i < n; i++) if(!mark[i]) S[i] = 0; int color = (tryCombination(S) == door); int l = 0, r = n - 1, pos = -1; while(l <= r){ int m = (l + r) >> 1; for(int i = l; i < m; i++) if(!mark[i]) S[i] = color; for(int i = m; i <= r; i++) if(!mark[i]) S[i] = !color; int query = tryCombination(S); if(query == door) l = m + 1; else r = m - 1, pos = m; } assert(pos != -1); mark[pos] = true; D[pos] = door; S[pos] = color; } 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...