제출 #717294

#제출 시각아이디문제언어결과실행 시간메모리
717294Juan동굴 (IOI13_cave)C++14
100 / 100
882 ms588 KiB
#include<bits/stdc++.h> #include "cave.h" using namespace std; void exploreCave(int N){ int S[N]={}, D[N]={}; vector<int> unprocessed; for(int i = 0; i < N; i++) unprocessed.push_back(i); for(int i = 0; i < N; i++){ for(int x : unprocessed) S[x] = 0; if(tryCombination(S)!=i){ for(int x : unprocessed) S[x] = 1; } int l = 0, r = unprocessed.size()-1; while(l<=r){ int m = (l+r)>>1; for(int j = 0; j <= m; j++) S[unprocessed[j]] ^= 1; int ret = tryCombination(S); if(ret==i) l = m+1; else r = m-1; for(int j = 0; j <= m; j++) S[unprocessed[j]] ^= 1; } int pos = unprocessed[l]; S[pos] ^= 1; D[pos] = i; unprocessed.erase(unprocessed.begin()+l); } 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...