Submission #236056

#TimeUsernameProblemLanguageResultExecution timeMemory
236056pere_gilCave (IOI13_cave)C++14
Compilation error
0 ms0 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); */ bool nochange[n]; for(int i=0;i<n;i++) nochange[i]=false; int dosw[n]; int onoff[n]; for(int i=0;i<n;i++){ int exp[n]; for(int i=0;i<n;i++){ if(nochange[i]) exp[i]=onoff[i]; else exp[i]=1; } } int trycom=tryCombination(exp); int good=0; if(trycom==-1 or trycom>i){ good=1; } ///ahora se viene lo chido binary int iz=0,der=n-1; while(iz<der){ int media=(der+iz)/2; for(int i=iz;i<=media;i++){ if(nochange[i]) exp[i]=good; else exp[i]=1-good; } trycom=tryCombination(exp); if(trycom==-1 or trycom>i) der=media; else iz=media+1; } nochange[iz]=true; dosw[iz]=i; onoff[iz]=good; answer(onoff,dosw); }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:36:13: warning: variable 'exp' set but not used [-Wunused-but-set-variable]
         int exp[n];
             ^~~
cave.cpp:43:31: error: 'exp' was not declared in this scope
     int trycom=tryCombination(exp);
                               ^~~
cave.cpp:43:31: note: suggested alternative: 'exit'
     int trycom=tryCombination(exp);
                               ^~~
                               exit
cave.cpp:45:29: error: 'i' was not declared in this scope
     if(trycom==-1 or trycom>i){
                             ^
cave.cpp:59:33: error: 'i' was not declared in this scope
         if(trycom==-1 or trycom>i) der=media;
                                 ^
cave.cpp:59:33: note: suggested alternative: 'iz'
         if(trycom==-1 or trycom>i) der=media;
                                 ^
                                 iz
cave.cpp:64:14: error: 'i' was not declared in this scope
     dosw[iz]=i;
              ^
cave.cpp:64:14: note: suggested alternative: 'iz'
     dosw[iz]=i;
              ^
              iz