Submission #545515

#TimeUsernameProblemLanguageResultExecution timeMemory
545515MohamedAliSaidaneCave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> #include "cave.h" using namespace std; typedef long long ll; typedef long double ld; typedef pair<int,int> pii; typedef pair<ll,ll> pll; typedef pair<ld,ld> pld; typedef vector<int> vi; typedef vector<ll> vll; typedef vector<pii> vpi; typedef vector<pll> vpl; #define pb push_back #define popb pop_back #define pf push_front #define popf pop_front #define all(x) (x).begin(),(x).end() #define ff first #define ss second int nx[4] = {0,0,1,-1}, ny[4] = {1,-1,0,0}; ll gcd(ll a , ll b) {return b ? gcd(b , a % b) : a ;} ll lcm(ll a , ll b) {return (a * b) / gcd(a , b);} /*int N; vi S, D, C; void answer(vi A, vi B) { for(int i = 0; i < N; i ++) cout << A[i] << ' '; cout << '\n'; for(int i = 0; i < N; i ++) cout << B[i] << ' '; } int tryCombination(vi A) { for(int door = 0; door < N;door ++) { if(A[C[door]] != S[C[door]]) return door; } return -1; }*/ void exploreCave(int n) { vi ans(n,0), st(n,0); vi cur; cur.assign(n,0); bool vis[n]; memset(vis,false,sizeof(vis)); for(int door = 0; door < n; door ++) { int repp = tryCombination(cur); if(repp == -1 || repp > door) { int debut = 0; int fin = n - 1; while(debut < fin) { int mid = (debut+fin)/2; for(int i = debut; i <= mid; i ++) { if(vis[i]) continue; cur[i] = 1; } int rep = tryCombination(cur); for(int i = debut; i <= mid; i ++) { if(vis[i]) continue; cur[i] = 0; } if(rep == door) { fin = mid; } else debut = mid + 1; } ans[debut] = door; st[fin] = cur[fin] = 0; vis[fin] = 1; } else { int debut = 0; int fin = n - 1; while(debut < fin) { int mid = (debut+fin)/2; for(int i = debut; i <= mid; i ++) { if(vis[i]) continue; cur[i] = 1; } int rep = tryCombination(cur); for(int i = debut; i <= mid; i ++) { if(vis[i]) continue; cur[i] = 0; } if(rep > door || rep == -1) { fin = mid; } else debut = mid + 1; } ans[debut] = door; st[fin] = cur[fin] = 1; vis[fin] = 1; } } answer(st,ans); }/* int main() { ios::sync_with_stdio(false); cin.tie(0); cout.tie(0); cin >> N; S.assign(N,0); D.assign(N,0); C.assign(N,0); for(int i = 0; i < N; i ++) cin >> S[i]; for(int i = 0; i < N; i ++) cin >> D[i]; for(int i = 0; i < N; i ++) C[D[i]] = i; exploreCave(N); } */

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:56:35: error: cannot convert 'vi' {aka 'std::vector<int>'} to 'int*'
   56 |         int repp = tryCombination(cur);
      |                                   ^~~
      |                                   |
      |                                   vi {aka 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:70:42: error: cannot convert 'vi' {aka 'std::vector<int>'} to 'int*'
   70 |                 int rep = tryCombination(cur);
      |                                          ^~~
      |                                          |
      |                                          vi {aka 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:103:42: error: cannot convert 'vi' {aka 'std::vector<int>'} to 'int*'
  103 |                 int rep = tryCombination(cur);
      |                                          ^~~
      |                                          |
      |                                          vi {aka 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:124:12: error: cannot convert 'vi' {aka 'std::vector<int>'} to 'int*'
  124 |     answer(st,ans);
      |            ^~
      |            |
      |            vi {aka std::vector<int>}
In file included from cave.cpp:2:
cave.h:9:17: note:   initializing argument 1 of 'void answer(int*, int*)'
    9 | void answer(int S[], int D[]);
      |             ~~~~^~~