제출 #383502

#제출 시각아이디문제언어결과실행 시간메모리
383502nicholask동굴 (IOI13_cave)C++14
컴파일 에러
0 ms0 KiB
#include <bits/stdc++.h> #include "cave.h" using namespace std; void exploreCave(int N){ int s[N],d[N]; for (int i=0; i<N; i++){ s[i]=0; d[i]=-1; } vector <int> ret; for (int i=0; i<N; i++){ ret.push_back(tryCombination(s)); int l=0,r=n-1; while (l<r){ int mid=(l+r)/2; for (int j=s; j<mid; j++){ if (d[j]==-1) s[j]^=1; } int cnt=0; if (ret.back()==i) cnt++; ret.push_back(tryCombination(s)); if (ret.back()==i) cnt++; if (cnt==1) r=mid; else l=mid+1; } if (ret.back()==i) s[l]^=1; d[l]=i; } answer(s,d); }

컴파일 시 표준 에러 (stderr) 메시지

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:13:13: error: 'n' was not declared in this scope
   13 |   int l=0,r=n-1;
      |             ^
cave.cpp:16:15: error: invalid conversion from 'int*' to 'int' [-fpermissive]
   16 |    for (int j=s; j<mid; j++){
      |               ^
      |               |
      |               int*