Submission #1005745

# Submission time Handle Problem Language Result Execution time Memory
1005745 2024-06-23T01:49:38 Z zh_h Cave (IOI13_cave) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "cave.h"
#define lint long long
#define pb push_back
#define mp make_pair
using namespace std;

// int tryCombination(vector<int> S);

// void answer(vector<int> S, vector<int> D);

void exploreCave(int N){
    vector<int> S;
    for(int i = 1; i < N; i ++){
        S.pb(0);
    }
    S.pb(1);
    
    // vector<pair<int, int>> v;
    vector<int> ans(N);

    for(int i = 0; i < N; i ++){
        ans[N-1-i] = tryCombination(S);
        // v.pb({tryCombination(S), N-1-i});
        S.erase(S.begin());
        S.pb(0);
    }

    S.erase(S.begin());
    S.pb(0);

    answer(S, ans);
}

// int main() {
//     ios_base::sync_with_stdio(false);
//     cin.tie(NULL);

    

//     return 0;
// }

Compilation message

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:23:37: error: cannot convert 'std::vector<int>' to 'int*'
   23 |         ans[N-1-i] = tryCombination(S);
      |                                     ^
      |                                     |
      |                                     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:12: error: cannot convert 'std::vector<int>' to 'int*'
   32 |     answer(S, 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[]);
      |             ~~~~^~~