Submission #687270

#TimeUsernameProblemLanguageResultExecution timeMemory
687270BliznetcCave (IOI13_cave)C++17
Compilation error
0 ms0 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; #define pb push_back #define sz size() #define all(x) x.begin(), x.end() #define F first #define S second typedef pair < int, int > pii; typedef vector < int > vi; typedef vector < vi > vvi; void exploreCave (int n) { vector<int> ask(n); vector<int> good(n, -1), d(n, -1); for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { if (good[j] != -1) { ask[j] = 0; } else { ask[j] = good[j]; } } int x = tryCombination(ask); if (x == i) { for (int j = 0; j < n; j++) { if (good[j] != -1) { ask[j] = 1; } else { ask[j] = good[j]; } } } int l = 0, r = n - 1; while (r - l > 1) { int mid = (l + r) / 2; for (int j = l; j < mid; j++) { if (good[j] != -1) { ask[j] = 1 - ask[j]; } else { ask[j] = good[j]; } } x = tryCombination(ask); if (x == i) { for (int j = l; j < mid; j++) { if (good[j] != -1) { ask[j] = 1 - ask[j]; } else { ask[j] = good[j]; } } for (int j = mid; j <= r; j++) { if (good[j] != -1) { ask[j] = 1 - ask[j]; } else { ask[j] = good[j]; } } r = mid - 1; } else { l = mid; } } if (good[l] != -1) { ask[l] = 1 - ask[l]; } else { ask[l] = good[l]; } x = tryCombination(ask); if (x == i) { if (good[l] != -1) { ask[l] = 1 - ask[l]; } else { ask[l] = good[l]; } l = r; } good[i] = ask[l]; d[i] = l; } answer(good, d); } /* signed main() { vi a; a.pb(-2); a.pb(2); a.pb(2); a.pb(-2); a.pb(-2); a.pb(2); cout << count_swaps(a); } */

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:30:32: error: cannot convert 'std::vector<int>' to 'int*'
   30 |         int x = tryCombination(ask);
      |                                ^~~
      |                                |
      |                                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:54:32: error: cannot convert 'std::vector<int>' to 'int*'
   54 |             x = tryCombination(ask);
      |                                ^~~
      |                                |
      |                                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:86:28: error: cannot convert 'std::vector<int>' to 'int*'
   86 |         x = tryCombination(ask);
      |                            ^~~
      |                            |
      |                            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:101:12: error: cannot convert 'std::vector<int>' to 'int*'
  101 |     answer(good, d);
      |            ^~~~
      |            |
      |            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[]);
      |             ~~~~^~~