제출 #132057

#제출 시각아이디문제언어결과실행 시간메모리
132057junodeveloper동굴 (IOI13_cave)C++14
컴파일 에러
0 ms0 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; int S[5010], D[5010], cur, idx, W; int Try() { int r = tryCombination(S); return r == -1 ? n : r; } void FindAll(int s, int e) { vector<int> a; for(int i=s; i<=e; i++) if(D[i] == -1) a.push_back(i); int B = (int)sqrt(sz(a)); if(s == 0 && e == n - 1) B = (sz(a) + 9) / 10; else B = (sz(a) + 1) / 2; for(int i=0; i<sz(a); i+=B) { int rgt = min(sz(a), i+B); for(int j=i; j<rgt; j++) S[a[j]] ^= 1; int r = Try(); for(int j=i; j<rgt; j++) S[a[j]] ^= 1; if(r != idx) { if(B == 1) { if(idx < r) { D[a[i]] = idx; W = a[i]; } else if(r < idx) D[a[i]] = r; } else FindAll(a[i], a[rgt - 1]); } } } void exploreCave(int N) { srand(123); memset(D, -1, sizeof(D)); for(int i=0; i<N; i++) S[i] = rand() % 2; cur = 0; while(cur < N) { idx = Try(); FindAll(0, n - 1); if(idx < n) S[W] ^= 1; cur = idx + 1; } answer(S, D); }

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

cave.cpp: In function 'int Try()':
cave.cpp:7:19: error: 'n' was not declared in this scope
  return r == -1 ? n : r;
                   ^
cave.cpp: In function 'void FindAll(int, int)':
cave.cpp:13:20: error: 'sz' was not declared in this scope
  int B = (int)sqrt(sz(a));
                    ^~
cave.cpp:13:20: note: suggested alternative: 's'
  int B = (int)sqrt(sz(a));
                    ^~
                    s
cave.cpp:15:20: error: 'n' was not declared in this scope
  if(s == 0 && e == n - 1) B = (sz(a) + 9) / 10;
                    ^
cave.cpp: In function 'void exploreCave(int)':
cave.cpp:40:14: error: 'n' was not declared in this scope
   FindAll(0, n - 1);
              ^