Submission #285447

#TimeUsernameProblemLanguageResultExecution timeMemory
285447Bill_00Cave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include "cave.h" int p[10000]={0},a[10000],up[10000]; void dfs(int l,int r,int L,int R,int id,int now){ for(int i=L;i<=R;i++){ if(p[i]!=0) continue; a[i]+=1; a[i]%=2; } int k=tryCombination(a); if(L==R && k!=id && now==0){ p[L+1]=id; up[L+1]=a[L+1]; return; } if(L==R && k==id && now==0){ p[L]=id; up[L]=(a[L]+1)%2; return; } if(L==R && k!=id && now==1){ p[L]=id; up[L]=a[L]; return; } if(L==R && k==id && now==1){ p[L+1]=id; up[L+1]=(a[L+1]+1)%2; return; } if(k!=id && now==1){ dfs(L,R,L,(L+R)/2,id,0); } if(k!=id && now==0){ if(R+1==l){ p[l]=id; up[l]=a[l]; return; } dfs(R+1,l,R+1,(l+R+1)/2,id,0); } if(k==id && now==1){ if(R+1==l){ p[l]=id; up[l]=(a[l]+1)%2; return; } dfs(R+1,l,R+1,(l+R+1)/2,id,1); } if(k==id && now==0){ dfs(L,R,L,(L+R)/2,id,1); } } void exploreCave(int n) { for(int i=0;i<n;i++){ a[i]=1; } for(int i=1;i<=n;i++){ int k=tryCombination(a); if(k==id) dfs(0,n-1,0,(n-1)/2,i,1); else dfs(0,n-1,0,(n-1)/2,i,0) } answer(up,p); }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:59:9: error: 'id' was not declared in this scope; did you mean 'i'?
   59 |   if(k==id) dfs(0,n-1,0,(n-1)/2,i,1);
      |         ^~
      |         i
cave.cpp:60:32: error: expected ';' before '}' token
   60 |   else dfs(0,n-1,0,(n-1)/2,i,0)
      |                                ^
      |                                ;
   61 |  }
      |  ~