Submission #1272710

#TimeUsernameProblemLanguageResultExecution timeMemory
1272710zagaro동굴 (IOI13_cave)C++20
Compilation error
0 ms0 KiB
#include<bits/stdc++.h>
#include "cave.h"
#include<ext/pb_ds/assoc_container.hpp>
/**zagaro & lauren <3**/
#define mod 1000000007 //1e9 + 7
#define pi acos(-1)
#define wl while
#define str string
#define ENDL "\n"
#define sal ' '
#define tp_set ll
#define prc(n) cout.precision(n);cout<<fixed;
#define ord_set tree<tp_set, null_type, less<tp_set>, rb_tree_tag, tree_order_statistics_node_update>
typedef long long ll;
typedef bool bl;
typedef char car;
using namespace std;
using namespace __gnu_pbds;
void exploreCave(int n) {
    int l, r, ind, m, opc, a, b;
    vector<int> D(n, -1);
    vector<int> S(n);
    vector<int> s;
    vector<pair<int,int> > vec;
    for(int i=0;i<n;i++){
        l = 0;
        r = n-1;
        s.assign(n, 0);
        for(int k=0;k<vec.size();k++)s[vec[k].first] = vec[k].second;
        opc = tryCombination(s);
        if(opc == -1)opc = n+1;
        if(opc > i){
            a=0;b=1;
            S[i] = 0;
            for(int k=0;k<n;k++){
                if(D[k] == -1)s[k] = b;
            }
        }
        else {a=1;b=0;S[i]=1;}
        wl(l < r){
            m = (l+r)/2;
            for(int k=l;k<=m;k++)if(D[k] == -1)s[k]=a;
            opc = tryCombination(s);
            if(opc == -1)opc= n+1;
            if(opc > i){
                for(int k=l;k<=m;k++)if(D[k] == -1)s[k]=b;
                r=m;
            }
            else l = m+1;
        }
        D[l] = i;
        vec.push_back({l,a});
    }
    answer(S, D);
    return ;
}

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:30:30: error: cannot convert 'std::vector<int>' to 'int*'
   30 |         opc = 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:43:34: error: cannot convert 'std::vector<int>' to 'int*'
   43 |             opc = tryCombination(s);
      |                                  ^
      |                                  |
      |                                  std::vector<int>
cave.h:8:24: note:   initializing argument 1 of 'int tryCombination(int*)'
    8 | int tryCombination(int S[]);
      |                    ~~~~^~~
cave.cpp:54:12: error: cannot convert 'std::vector<int>' to 'int*'
   54 |     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[]);
      |             ~~~~^~~