Submission #1006253

#TimeUsernameProblemLanguageResultExecution timeMemory
1006253TymondCave (IOI13_cave)C++17
Compilation error
0 ms0 KiB
#include "cave.h" #include <bits/stdc++.h> using namespace std; using ll = long long; using ld = long double; #define fi first #define se second #define vi vector<int> #define vll vector<long long> #define pii pair<int, int> #define pll pair<long long, long long> #define pb push_back #define mp make_pair #define eb emplace_back #define all(x) (x).begin(), (x).end() #define sz(x) (int)(x).size() mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); mt19937_64 rng64(chrono::steady_clock::now().time_since_epoch().count()); inline int rand(int l,int r){return uniform_int_distribution<int>(l, r)(rng);} inline ll rand(ll l,ll r){return uniform_int_distribution<ll>(l, r)(rng64);} const int MAXN = 5e3 + 7; int s[MAXN]; int d[MAXN]; bool f[MAXN]; void update(int l, int p){ for(int i = l; i <= p; i++){ if(!f[i]){ s[i] = (s[i] ^ 1); } } } void exploreCave(int n) { for(int i = 0; i < n; i++){ int res = tryCombination(n, s); int z = ((res > i || r == -1) ^ 1); int l = 0; int p = n - 1; int s; while(l < p){ s = (l + p) / 2; update(l, s); res = tryCombination(n, s); update(l, s); int nz = ((res > i || r == -1) ^ 1); if(nz != z){ p = s; }else{ l = s + 1; } } f[i] = 1; s[i] = z; d[l] = i; } answer(n, s, d); }

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:37:34: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   37 |         int res = tryCombination(n, s);
      |                                  ^
      |                                  |
      |                                  int
cave.cpp:37:38: error: too many arguments to function 'int tryCombination(int*)'
   37 |         int res = tryCombination(n, s);
      |                                      ^
In file included from cave.cpp:1:
cave.h:8:5: note: declared here
    8 | int tryCombination(int S[]);
      |     ^~~~~~~~~~~~~~
cave.cpp:38:30: error: 'r' was not declared in this scope
   38 |         int z = ((res > i || r == -1) ^ 1);
      |                              ^
cave.cpp:46:34: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   46 |             res = tryCombination(n, s);
      |                                  ^
      |                                  |
      |                                  int
cave.cpp:46:38: error: too many arguments to function 'int tryCombination(int*)'
   46 |             res = tryCombination(n, s);
      |                                      ^
In file included from cave.cpp:1:
cave.h:8:5: note: declared here
    8 | int tryCombination(int S[]);
      |     ^~~~~~~~~~~~~~
cave.cpp:57:10: error: invalid types 'int[int]' for array subscript
   57 |         s[i] = z;
      |          ^
cave.cpp:61:12: error: invalid conversion from 'int' to 'int*' [-fpermissive]
   61 |     answer(n, s, d);
      |            ^
      |            |
      |            int
cave.cpp:61:19: error: too many arguments to function 'void answer(int*, int*)'
   61 |     answer(n, s, d);
      |                   ^
In file included from cave.cpp:1:
cave.h:9:6: note: declared here
    9 | void answer(int S[], int D[]);
      |      ^~~~~~