제출 #384092

#제출 시각아이디문제언어결과실행 시간메모리
384092alishahali1382동굴 (IOI13_cave)C++14
100 / 100
486 ms748 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; const int MAXN=5010; int A[MAXN]; int match[MAXN], mark[MAXN]; inline int ask(){ return tryCombination(A);} void exploreCave(int n){ for (int i=0; i<n; i++) mark[i]=1; for (int i=0; i<n; i++){ if (ask()!=i) for (int j=0; j<n; j++) A[j]^=mark[j]; // now tryCombination is i int dwn=0, up=n; while (up-dwn>1){ int mid=(dwn+up)>>1; for (int j=0; j<mid; j++) A[j]^=mark[j]; if (ask()==i) dwn=mid; else up=mid; for (int j=0; j<mid; j++) A[j]^=mark[j]; } match[dwn]=i; mark[dwn]=0; A[dwn]^=1; } answer(A, match); }
#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...