Submission #1320168

#TimeUsernameProblemLanguageResultExecution timeMemory
1320168yessimkhanCave (IOI13_cave)C++20
Compilation error
0 ms0 KiB
#include "cave.h"
#include <bits/stdc++.h>
// solved by bekagg
#define ll long long
#define ent '\n'
#define pb push_back
#define all(x) x.begin(),x.end()
#define PRaim_bek_abi ios_base::sync_with_stdio(0);cin.tie(0);

using namespace std;

const int N = 5e5+5;
const int MOD = 1e9+7;

int d[N] , cnt;
bool us[N] , s[N];

void exploreCave(int n){
    bool t = 1;
    while(cnt < n){
        t = 1 - t;

        for (int i = 0; i < n; i++){
            if (us[i]) continue;
            s[i] = t;
        }

        int p = tryCombination(s);

        if (p == -1){
            for (int i = 0; i < n; i++){
                if (us[i]) continue;
                s[i] = 1 - t;
                int pos = tryCombination(s);
                s[i] = t;
                d[i] = pos;
                us[i] = 1;
                cnt++;
            }
            break;
        }

        for (int i = 0; i < n; i++){
            if (us[i]) continue;
            s[i] = 1 - t;
            int pos = tryCombination(s);
            if (pos != -1 and pos < p){
                d[i] = pos;
                us[i] = 1;
                cnt++;
            }
            s[i] = t;
        }

    }

    answer(s , d);
}

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:28:32: error: cannot convert 'bool*' to 'int*'
   28 |         int p = tryCombination(s);
      |                                ^
      |                                |
      |                                bool*
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:34:42: error: cannot convert 'bool*' to 'int*'
   34 |                 int pos = tryCombination(s);
      |                                          ^
      |                                          |
      |                                          bool*
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp:46:38: error: cannot convert 'bool*' to 'int*'
   46 |             int pos = tryCombination(s);
      |                                      ^
      |                                      |
      |                                      bool*
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp:57:12: error: cannot convert 'bool*' to 'int*'
   57 |     answer(s , d);
      |            ^
      |            |
      |            bool*
cave.h:9:17: note:   initializing argument 1 of 'void answer(int*, int*)'
    9 | void answer(int S[], int D[]);
      |             ~~~~^~~