제출 #672744

#제출 시각아이디문제언어결과실행 시간메모리
672744Hacv16동굴 (IOI13_cave)C++17
0 / 100
73 ms404 KiB
#include<bits/stdc++.h> #include "cave.h" using namespace std; typedef long long ll; const int MAX = 2e6 + 15; const int INF = 0x3f3f3f3f; int n, S[MAX], D[MAX]; bool mark[MAX]; bool f(int l, int r, int m, int j, int c){ for(int i = l; i < m; i++) if(!mark[i]) S[i] = c; for(int i = m; i <= r; i++) if(!mark[i]) S[i] = !c; int query = tryCombination(S); return (query != j); } void exploreCave(int n_){ n = n_; 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; if(f(l, r, m, door, color)) r = m - 1, pos = m; else l = m + 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...