Submission #571942

#TimeUsernameProblemLanguageResultExecution timeMemory
571942SlavicGCave (IOI13_cave)C++17
Compilation error
0 ms0 KiB
#include "cave.h" #include "bits/stdc++.h" using namespace std; #define ll long long #define forn(i,n) for(int i=0;i<n;i++) #define all(v) v.begin(), v.end() #define rall(v) v.rbegin(),v.rend() #define pb push_back #define sz(a) (int)a.size() /* int tryCombination(vector<int> s) { for(auto x: s) cout << x << " "; cout << "\n"; int f; cin >> f; return f; } void answer(vector<int> s, vector<int> d) { for(auto x: s) cout << x << " "; cout << "\n"; for(auto x: d) cout << x << " "; cout << "\n"; } */ void exploreCave(int n) { vector<int> d(n, -1); vector<int> s(n, -1); int lst = -1; for(int i = 0; i < n; ++i) { vector<int> tmp = s; forn(j, n) if(s[j] == -1) tmp[j] = 0; int x = tryCombination(tmp); int need = 0; if(x == -1) x = n; if(x <= i) { need = 1; forn(j, n) if(s[j] == -1) tmp[j] = 1; } d[i] = need; int l = 0, r = n - 1, pos = -1; while(l <= r) { int mid = l + r >> 1; for(int j = mid; j < n; ++j) { if(s[j] == -1) { tmp[j] = !need; } } x = tryCombination(tmp); if(x <= i) { r = mid - 1; } else { pos = mid; l = mid + 1; } } s[pos] = i; } answer(s, d); } /* void solve() { int n; cin >> n; exploreCave(n); } int32_t main() { //ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); int t = 1; //cin >> t; while(t--) { solve(); } } */

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:39:32: error: cannot convert 'std::vector<int>' to 'int*'
   39 |         int x = tryCombination(tmp);
      |                                ^~~
      |                                |
      |                                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:49:25: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   49 |             int mid = l + r >> 1;
      |                       ~~^~~
cave.cpp:55:32: error: cannot convert 'std::vector<int>' to 'int*'
   55 |             x = tryCombination(tmp);
      |                                ^~~
      |                                |
      |                                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:65:12: error: cannot convert 'std::vector<int>' to 'int*'
   65 |     answer(s, 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[]);
      |             ~~~~^~~
cave.cpp:34:9: warning: unused variable 'lst' [-Wunused-variable]
   34 |     int lst = -1;
      |         ^~~