Submission #1283996

#TimeUsernameProblemLanguageResultExecution timeMemory
1283996talyCave (IOI13_cave)C++20
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#define pii pair<int, int>
#define tii tuple<int, int, int>
#define lli long long
// #define f first
// #define s second
#define pb push_back
using namespace std;
#include "cave.h"
// void exploreCave(int n);
// void answer(int S[],int D[]);
// int tryCombination(int S[]);

void exploreCave(int n){
    vector<int> s(n), d(n, -1);
    int c = 0;
    int f1 = tryCombination(s);
    int f2 = f1;
    int last = -1;
    while(f2!=n){
        while(f1==f2){
            while(d[last]!=-1)last++;
            s[last]=1-s[last];
            f2 = tryCombination(s);
        }
        if(f2==-1)f2=n;
        if(f1<f2){
            d[f1]=last;
            c++;
        }else{
            d[f2]=last;
            s[f2]=1-s[f2];
            c++;
        }
        f1=f2;
    }
    answer(s, d);
}

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:17:29: error: cannot convert 'std::vector<int>' to 'int*'
   17 |     int f1 = tryCombination(s);
      |                             ^
      |                             |
      |                             std::vector<int>
In file included from cave.cpp:9:
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp:24:33: error: cannot convert 'std::vector<int>' to 'int*'
   24 |             f2 = tryCombination(s);
      |                                 ^
      |                                 |
      |                                 std::vector<int>
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp:37:12: error: cannot convert 'std::vector<int>' to 'int*'
   37 |     answer(s, d);
      |            ^
      |            |
      |            std::vector<int>
cave.h:9:17: note:   initializing argument 1 of 'void answer(int*, int*)'
    9 | void answer(int S[], int D[]);
      |             ~~~~^~~