제출 #544158

#제출 시각아이디문제언어결과실행 시간메모리
544158krit3379동굴 (IOI13_cave)C++14
컴파일 에러
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 ; }

컴파일 시 표준 에러 (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;
      |                 ^