제출 #648881

#제출 시각아이디문제언어결과실행 시간메모리
648881Truitadepatates동굴 (IOI13_cave)C++17
컴파일 에러
0 ms0 KiB
int Sol[n]; bool fet[n]; for (int i = 0; i < n; i++){ S[i] = 0; D[i] = -1; Sol[i] = -1; fet[i] = false; } if (tryCombination(S) == -1){ for (int i = 0; i < n; i++){ S[i] = 1; D[i] = tryCombination(S); S[i] = 0; } } else{ for (int i = 0; i < n; i++){ int hola; if (tryCombination(S) == i) hola = 1; else hola = 0; int l = 0, r = n-1; while (l < r) { int m = (l+r)/2; for (int j = 0; j < n; j++) { if (fet[j]) Sol[j] = S[j]; else Sol[j] = 0; } for (int j = l; j <= m; j++){ if (not fet[j]){ Sol[j] = 1; } } if (hola == 1){ if (tryCombination(Sol) == i) l = m+1; else r = m; } else{ if (tryCombination(Sol) == i) r = m; else l = m+1; } } S[m] = hola; fet[m] = true; D[m] = i; } } answer(S, D); }

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

cave.cpp:1:11: error: 'n' was not declared in this scope
    1 |   int Sol[n];
      |           ^
cave.cpp:2:12: error: 'n' was not declared in this scope
    2 |   bool fet[n];
      |            ^
cave.cpp:3:3: error: expected unqualified-id before 'for'
    3 |   for (int i = 0; i < n; i++){
      |   ^~~
cave.cpp:3:19: error: 'i' does not name a type
    3 |   for (int i = 0; i < n; i++){
      |                   ^
cave.cpp:3:26: error: 'i' does not name a type
    3 |   for (int i = 0; i < n; i++){
      |                          ^
cave.cpp:9:3: error: expected unqualified-id before 'if'
    9 |   if (tryCombination(S) == -1){
      |   ^~
cave.cpp:16:3: error: expected unqualified-id before 'else'
   16 |   else{
      |   ^~~~
cave.cpp:47:9: error: expected constructor, destructor, or type conversion before '(' token
   47 |   answer(S, D);
      |         ^
cave.cpp:48:1: error: expected declaration before '}' token
   48 | }
      | ^