Submission #985335

#TimeUsernameProblemLanguageResultExecution timeMemory
985335user736482Cave (IOI13_cave)C++17
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include<cave.h> using namespace std; int match[5000],sent[5000]; bool openstate,fixed_[5000]; int ak; void change(int a, int b, int c){ for(int i=a;i<=b;i++){ if(!fixed_[i]) sent[i]= c; } } void exploreCave(int n){ for(int i=0;i<n;i++){ change(0,4999,1); ak = tryCombination(sent); if(ak!=i){ openstate=1; } else{ openstate=0; } int pocz=0; int kon=0; while(pocz<kon){ int sr=(pocz+kon)/2; change(pocz,sr,openstate); change(sr+1,kon,!openstate); ak=tryCombination(sent); if(ak > j || ak==-1) { kon=sr; } else{ pocz=sr+1; } } sent[pocz]=openstate; match[j]=pocz; fixed_[pocz]=1; } }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:31:21: error: 'j' was not declared in this scope
   31 |             if(ak > j || ak==-1)
      |                     ^
cave.cpp:40:15: error: 'j' was not declared in this scope
   40 |         match[j]=pocz;
      |               ^