Submission #670618

#TimeUsernameProblemLanguageResultExecution timeMemory
670618gustavo_dCave (IOI13_cave)C++17
Compilation error
0 ms0 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; int exploreCave(int n) { vector<int> confirmed = vector<int> (n, -1); vector<int> test = vector<int> (n, 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:11:33: error: cannot convert 'std::vector<int>' to 'int*'
   11 |     int to_try = tryCombination(test);
      |                                 ^~~~
      |                                 |
      |                                 std::vector<int>
In file included from cave.cpp:1:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp:12:28: error: 'tried' was not declared in this scope
   12 |     while (to_try != -1 && tried != -1) {
      |                            ^~~~~
cave.cpp:23:40: error: cannot convert 'std::vector<int>' to 'int*'
   23 |             int tried = tryCombination(test);
      |                                        ^~~~
      |                                        |
      |                                        std::vector<int>
In file included from cave.cpp:1:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp:30:19: error: 'i' was not declared in this scope
   30 |         confirmed[i] = l;
      |                   ^
cave.cpp:36:12: error: cannot convert 'std::vector<int>' to 'int*'
   36 |     answer(confirmed);
      |            ^~~~~~~~~
      |            |
      |            std::vector<int>
In file included from cave.cpp:1:
cave.h:9:17: note:   initializing argument 1 of 'void answer(int*, int*)'
    9 | void answer(int S[], int D[]);
      |             ~~~~^~~