제출 #1124361

#제출 시각아이디문제언어결과실행 시간메모리
1124361Rainmaker2627동굴 (IOI13_cave)C++20
100 / 100
195 ms576 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; bool vis[5005]; void exploreCave(int N) { int S[N], D[N]; for(int i = 0; i < N; ++i) { int cor; vector<int> p; for(int j = 0; j < N; ++j) if (!vis[j]) p.push_back(j); for(int j = 0; j < N-i; ++j) S[p[j]] = 0; if (tryCombination(S)==i) cor = 1; else cor = 0; for(int j = 0; j < N-i; ++j) S[p[j]] = cor^1; int l=0, r=N-i-1; while (l<r) { int mid = (l+r)/2; for (int j = l; j <= mid; ++j) S[p[j]] = cor; int res = tryCombination(S); for (int j = l; j <= mid; ++j) S[p[j]] = cor^1; if (res==i) l=mid+1; else r=mid; } D[p[l]] = i; S[p[l]] = cor; vis[p[l]] = true; } 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...