제출 #670619

#제출 시각아이디문제언어결과실행 시간메모리
670619gustavo_d동굴 (IOI13_cave)C++17
컴파일 에러
0 ms0 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; int exploreCave(int n) { int confirmed[n]; int test[n]; for (int i = 0; i < n; i++) { confirmed[i] = -1; test[i] = 0; } ios_base::sync_with_stdio(false); cin.tie(NULL); int to_try = tryCombination(test); while (to_try != -1 && tried != -1) { int l = 0; int r = n; while (l != r) { int mid = (l+r) / 2; for (int i = l; i<r; i++) { if (confirmed[i] != -1) test[i] = confirmed[i]; else { if (i < mid) test[i] = 0; else test[i] = 1; } } int tried = tryCombination(test); if (to_try != tried) { r = mid; } else { l = mid + 1; } } confirmed[i] = l; to_try = tried; } for (int i=0; i<n; i++) { if (confirmed[i] == -1) confirmed[i] = 0; } answer(confirmed); return 0; }

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

cave.cpp:5:5: error: ambiguating new declaration of 'int exploreCave(int)'
    5 | int exploreCave(int n) {
      |     ^~~~~~~~~~~
In file included from cave.cpp:1:
cave.h:10:6: note: old declaration 'void exploreCave(int)'
   10 | void exploreCave(int N);
      |      ^~~~~~~~~~~
cave.cpp: In function 'int exploreCave(int)':
cave.cpp:18:28: error: 'tried' was not declared in this scope
   18 |     while (to_try != -1 && tried != -1) {
      |                            ^~~~~
cave.cpp:36:19: error: 'i' was not declared in this scope
   36 |         confirmed[i] = l;
      |                   ^
cave.cpp:42:21: error: too few arguments to function 'void answer(int*, int*)'
   42 |     answer(confirmed);
      |                     ^
In file included from cave.cpp:1:
cave.h:9:6: note: declared here
    9 | void answer(int S[], int D[]);
      |      ^~~~~~