제출 #330632

#제출 시각아이디문제언어결과실행 시간메모리
330632Falcon동굴 (IOI13_cave)C++17
100 / 100
631 ms876 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; void exploreCave(int N) { int S[N]; fill(S, S + N, 0); bool can_flip[N]; fill(can_flip, can_flip + N, true); auto query = [&](int l) { for(int i{}; i < l; ++i) S[i] ^= can_flip[i]; int x = tryCombination(S); for(int i{}; i < l; ++i) S[i] ^= can_flip[i]; return x; }; int D[N]; for(int i{}; i < N; ++i) { int x{}; if(tryCombination(S) != i) for(int j{}; j < N; ++j) S[j] ^= can_flip[j]; for(int k = 1 << __lg(N); k > 0; k >>= 1) if(k + x < N && query(k + x) == i) x += k; D[x] = i; S[x] ^= 1; can_flip[x] = false; } 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...