Submission #544158

#TimeUsernameProblemLanguageResultExecution timeMemory
544158krit3379Cave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> using namespace std; #include"cave.h" #define N 5005 int s[N],ans[N]; void exploreCave(int n){ int i,l,r,mid,flag,now; for(i=0;i<n;i++)ans[i]=-1; for(i=0;i<n;i++){ l=0,r=n-1; flag=(tryCombination(s)==i); while(l<r){ mid=(l+r)/2; for(j=l;j<=mid;j++)if(ans[j]==-1)s[i]=1; now=(tryCombination(s)==i); for(j=l;j<=mid;j++)if(ans[i]==-1)s[i]=0; if(flag==now)l=mid+1; else r=mid; } ans[l]=i,s[i]=flag; } answer(s,ans); return ; }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:16:17: error: 'j' was not declared in this scope
   16 |             for(j=l;j<=mid;j++)if(ans[j]==-1)s[i]=1;
      |                 ^
cave.cpp:18:17: error: 'j' was not declared in this scope
   18 |             for(j=l;j<=mid;j++)if(ans[i]==-1)s[i]=0;
      |                 ^