Submission #798588

#TimeUsernameProblemLanguageResultExecution timeMemory
798588LiudasCave (IOI13_cave)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "cave.h"
using namespace std;
void exploreCave(int N){
    vector<bool> lock(N, false);
    vector<int> ans(N, -1);
    vector<int> check(N, 0);
    for(int i = 0; i < N; i ++){
        for(int j = 0; j < N; j ++){
            if(!lock[j]){
                check[j] = 0;
            }
        }
        int sign = 0, op;
        int t = tryCombination(check);
        if(t > i){
            sign = 0;
        }
        else{
            sign = 1;
        }
        op = abs(sign - 1);
        int l = 0, r = N;
        while(l + 1 < r){
            int mid = (l + r+1) / 2;
            for(int j = l; j < mid; j ++){
                if(!lock[j])check[j]=sign;
            }
            for(int j = mid; j < r; j ++){
                if(!lock[j])check[j]=op;
            }
            int a = tryCombination(check);
            if(a <= i && a >= 0){
                l = mid;
            }
            else{
                r = mid;
            }
        }
        lock[l] = true;
        ans[l] = i;
        check[l] = sign;
    }
    answer(check, ans);
}

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:15:32: error: cannot convert 'std::vector<int>' to 'int*'
   15 |         int t = tryCombination(check);
      |                                ^~~~~
      |                                |
      |                                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:32:36: error: cannot convert 'std::vector<int>' to 'int*'
   32 |             int a = tryCombination(check);
      |                                    ^~~~~
      |                                    |
      |                                    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:44:12: error: cannot convert 'std::vector<int>' to 'int*'
   44 |     answer(check, ans);
      |            ^~~~~
      |            |
      |            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[]);
      |             ~~~~^~~