Submission #755285

#TimeUsernameProblemLanguageResultExecution timeMemory
755285Godgift42Cave (IOI13_cave)C++14
0 / 100
48 ms408 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-1; 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); }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:49:19: warning: 't' may be used uninitialized in this function [-Wmaybe-uninitialized]
   49 |             if(s[t]==0) s[t]++;
      |                ~~~^
#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...