Submission #1313386

#TimeUsernameProblemLanguageResultExecution timeMemory
1313386shirokitoCave (IOI13_cave)C++20
Compilation error
0 ms0 KiB
#ifndef LOCAL #include "cave.h" #endif #include <bits/stdc++.h> using namespace std; #define all(a) (a).begin(), (a).end() #define fi first #define se second using ll = long long; const int N = 5000 + 24; void exploreCave(int N) { int n = N; vector<int> state(n, 0), can(n, 1); for (int i = 0; i < n; i++) { int k = tryCombination(state); int m = tryCombination(can); if (m != -1 && m < k) { int pos = -1; for (int l = 0, r = n - 1; l <= r; ) { int mid = (l + r) >> 1; vector<int> new_state = state; for (int i = 0; i <= mid; i++) { if (can[i]) new_state[i] = 1; } int jury_ans = tryCombination(new_state); if (jury_ans != -1 && jury_ans < k) { pos = mid; r = mid - 1; } else l = mid + 1; } if (pos != -1) { can[pos] = 0; // cout << "POS = " << pos << "\n"; } } else { int pos = -1; for (int l = 0, r = n - 1; l <= r; ) { int mid = (l + r) >> 1; vector<int> new_state = state; for (int i = 0; i <= mid; i++) { if (can[i]) new_state[i] = 1; } int jury_ans = tryCombination(new_state); if (jury_ans == -1 || jury_ans > k) { pos = mid; r = mid - 1; } else l = mid + 1; } if (pos != -1) { // cout << "POS = " << pos << "\n"; state[pos] = 1; } } } vector<int> d(n); for (int i = 0; i < n; i++) { vector<int> new_state = state; new_state[i] ^= 1; d[i] = tryCombination(new_state); } return answer(state, d); }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:22:32: error: cannot convert 'std::vector<int>' to 'int*'
   22 |         int k = tryCombination(state);
      |                                ^~~~~
      |                                |
      |                                std::vector<int>
In file included from cave.cpp:2:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp:23:32: error: cannot convert 'std::vector<int>' to 'int*'
   23 |         int m = tryCombination(can);
      |                                ^~~
      |                                |
      |                                std::vector<int>
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp:37:47: error: cannot convert 'std::vector<int>' to 'int*'
   37 |                 int jury_ans = tryCombination(new_state);
      |                                               ^~~~~~~~~
      |                                               |
      |                                               std::vector<int>
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp:64:47: error: cannot convert 'std::vector<int>' to 'int*'
   64 |                 int jury_ans = tryCombination(new_state);
      |                                               ^~~~~~~~~
      |                                               |
      |                                               std::vector<int>
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp:85:31: error: cannot convert 'std::vector<int>' to 'int*'
   85 |         d[i] = tryCombination(new_state);
      |                               ^~~~~~~~~
      |                               |
      |                               std::vector<int>
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp:88:19: error: cannot convert 'std::vector<int>' to 'int*'
   88 |     return answer(state, d);
      |                   ^~~~~
      |                   |
      |                   std::vector<int>
cave.h:9:17: note:   initializing argument 1 of 'void answer(int*, int*)'
    9 | void answer(int S[], int D[]);
      |             ~~~~^~~