제출 #1115675

#제출 시각아이디문제언어결과실행 시간메모리
1115675Zflop동굴 (IOI13_cave)C++14
0 / 100
16 ms864 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; const int NMAX = (int)1e3 * 6; int S[NMAX],D[NMAX]; bool fixat[NMAX]; void exploreCave(int N) { vector<pair<int,int>>buton; buton.push_back({0,0}); for (int i = 0; i < N;++i) buton[i] = {0,i}; for (int i = 0; i < N;++i) { int a = tryCombination(S); if (a == i) { for (int j = 1; j < (int)buton.size();++j) S[buton[j].second] ^= 1; } int l = 1,r = (int)buton.size() - 1; int ans = 1; while (l <= r) { int mid = (l + r) / 2; for (int g = l; g <= mid;++g) S[buton[g].second] ^= 1; a = tryCombination(S); if (a == i) { ans = mid; r = mid - 1; for (int g = l; g <= mid;++g) S[buton[g].second] ^= 1; } else l = mid + 1; } buton.erase(buton.begin() + ans); D[i] = ans; } 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...