제출 #281726

#제출 시각아이디문제언어결과실행 시간메모리
281726Kastanda동굴 (IOI13_cave)C++11
100 / 100
348 ms760 KiB
// M #include<bits/stdc++.h> #include "cave.h" using namespace std; const int N = 5005; int C[N], M[N]; void exploreCave(int n) { memset(M, -1, sizeof(M)); for (int i = 0; i < n; i ++) { int rs = tryCombination(C); if (rs == -1) rs = n; assert(rs >= i); int w = (rs == i); vector < int > vec; for (int j = 0; j < n; j ++) if (M[j] == -1) vec.push_back(j); int le = 0, ri = (int)vec.size(), md; while (ri - le > 1) { md = (le + ri) >> 1; for (int j = md; j < ri; j ++) C[vec[j]] ^= 1; int w2 = tryCombination(C) == i; if (w2 == w) ri = md; else le = md; for (int j = md; j < ri; j ++) C[vec[j]] ^= 1; } M[vec[le]] = i; if (w == 1) C[vec[le]] ^= 1; } answer(C, M); return ; }
#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...