Submission #110997

#TimeUsernameProblemLanguageResultExecution timeMemory
110997The_WolfpackCave (IOI13_cave)C++14
100 / 100
1322 ms608 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; int ans[5006]; int tmp[5006]; int doors[5006]; void exploreCave(int N) { memset(ans,-1,sizeof(ans)); for(int i=0;i<N;i++) { for(int i1=0;i1<5005;i1++) tmp[i1]=0; for(int j=0;j<N;j++) if(ans[j]!=-1) tmp[j]=ans[j]; int sta=0; if(tryCombination(tmp)==i) sta=1; int koji; int L=0; int R=N-1; while(L!=R) { int mid=(L+R)/2; for(int j=L;j<=mid;j++) tmp[j]=sta; for(int j=mid+1;j<=R;j++) tmp[j]=1-sta; for(int j=0;j<N;j++) if(ans[j]!=-1) tmp[j]=ans[j]; if(tryCombination(tmp)==i) L=mid+1; else{R=mid;} } doors[L]=i; ans[L]=sta; } answer(ans,doors); }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:19:13: warning: unused variable 'koji' [-Wunused-variable]
         int koji;        
             ^~~~
#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...