Submission #755294

#TimeUsernameProblemLanguageResultExecution timeMemory
755294Godgift42동굴 (IOI13_cave)C++14
0 / 100
100 ms384 KiB
#include "cave.h" using namespace std; void exploreCave(int N) { int s[N]; int d[N]; int c[N]; for(int i=0;i<N;i++){ s[i]=0; c[N]=0; } for(int i=0;i<N;i++){ int e = tryCombination(s); if(e==i){ for(int j=0;j<N;j++){ if(!c[j]){ if(s[j]==0) s[j]++; else s[j]--; } } } int l=0;int r=N; int pre=1; int t; while(l<r){ t=(l+r)/2; for(int j=l;j<=t;j++){ if(!c[j]){ if(s[j]==0) s[j]++; else s[j]--; } } e = tryCombination(s); if(e==i) e=0; else e=1; if((e==0 and pre==1) or (e==1 and pre==0)){ r=t; if(l!=r) pre=e; } else{ l = t+1; if(l!=r) pre=e; } } d[t]=i; c[t]=1; if(e==0){ if(s[t]==0) s[t]++; else s[t]--; } } 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...