Submission #235305

#TimeUsernameProblemLanguageResultExecution timeMemory
235305pere_gilCave (IOI13_cave)C++14
0 / 100
6 ms512 KiB
#include <iostream> #include "cave.h" using namespace std; void exploreCave(int n) { ///da 25pts /* int D[N],S[N]; for(int i=0;i<N;i++){ S[i]=0; } if(tryCombination(S)==-1){ for(int i=0;i<N;i++){ S[i]=1; D[i]=tryCombination(S); S[i]=0; } } else{ for(int i=0;i<N;i++){ D[i]=i; if(tryCombination(S)==i) S[i]=1; } } answer(S,D); */ ///fuerza bruta int s[n],d[n],sw[n]; for(int i=0;i<n;i++){ sw[i]=-2; } for(int i=0;i<n-1;i++){ for(int j=0;j<n;j++){ sw[j]=0; if(tryCombination(sw)==i+1){ s[j]=0; d[i]=j; } else{ sw[j]=1; if(tryCombination(sw)==i+1){ s[j]=1; d[i]=j; } else sw[j]=-2; } } } int ja; for(int i=0;i<n;i++){ if(sw[i]==-2){ ja=i; } } s[ja]=0; if(tryCombination(s)==-1) answer(s,d); else{ s[ja]=1; answer(s,d); } }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:44:9: warning: 'ja' may be used uninitialized in this function [-Wmaybe-uninitialized]
     int ja;
         ^~
#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...