제출 #106336

#제출 시각아이디문제언어결과실행 시간메모리
106336Kenzo_1114동굴 (IOI13_cave)C++14
51 / 100
1121 ms636 KiB
#include<bits/stdc++.h> #include"cave.h" #define debug(args...) //fprintf(stderr,args) using namespace std; const int MAXN=5010; set<int> s; int N,resp[MAXN],porta[MAXN],v[MAXN]; /* int tryCombination(int v[]) { for(int i=0;i<N;i++) printf("%d ",v[i]); printf("\n"); int a; scanf("%d",&a); return a; } */ void color(int i,int j,int v[]) { for(;i<=j;i++) { if(s.find(i)!=s.end()) continue; v[i]^=1; } } void exploreCave(int N) { for(int i=0;i<N;i++) { int ini=0,fim=N-1, case1=tryCombination(v); while(ini<fim) { int m=(ini==fim-1) ? ini : (ini+fim)/2; debug("ini = %d fim = %d m = %d\n",ini,fim,m); debug("Case 1 :\n"); debug("\n"); if(case1==-1) case1=MAXN; if(case1<=i) { color(ini,m,v); int case2=tryCombination(v); if(case2<=i && case2!=-1) case1=case2, ini=m+1; else{ color(ini,m,v), case1=tryCombination(v); fim=m; } } else { color(ini,m,v); int case2=tryCombination(v); if(case2<=i && case2!=-1) case1=case2, fim=m; else{ color(m+1,fim,v), case1=tryCombination(v); ini=m+1; } } } s.insert(ini); porta[ini]=i; v[ini]^=1; debug("I = %d v[%d] = %d\n",i,ini,v[ini]); } answer(v,porta); } /* int main () { scanf("%d",&N); exploreCave(N); for(int i=0;i<N;i++) printf("%d ",v[i]); printf("\n"); for(int i=0;i<N;i++) printf("%d ",porta[i]); printf("\n"); } */
#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...