Submission #670619

#TimeUsernameProblemLanguageResultExecution timeMemory
670619gustavo_dCave (IOI13_cave)C++17
Compilation error
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; }

Compilation message (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[]);
      |      ^~~~~~