Submission #1080767

#TimeUsernameProblemLanguageResultExecution timeMemory
1080767jcelinCave (IOI13_cave)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h>
#include "cave.h"
using namespace std;

typedef long long ll;
typedef pair<int,int> ii;
typedef pair<ll,ll> pll;
typedef vector<int> vi;
typedef vector<ii> vii;
typedef vector<ll> vll;
typedef vector<pll> vpll;

#define PB push_back
#define PF push_front
#define PPB pop_back
#define PPF pop_front
#define X first
#define Y second
#define MP make_pair
#define all(x) (x).begin(), (x).end()

const int mod = 1e9 + 7; //998244353;
const int inf = 1e9 + 7;
const ll INF = 1e18 + 7;
const int logo = 20;
const int MAXN = 1e6 + 7;
const int off = 1 << logo;
const int trsz = off << 1;
const int dx[] = {1, -1, 0, 0};
const int dy[] = {0, 0, -1, 1};

vi s, d;

void exploreCave(int n){
	s.resize(n);
	d.resize(n, -1);
	int lst = tryCombination(s);
	for(int i=0; i<n; i++){
		int lo = 0, hi = n - 1;
		while(lo < hi){
			int mid = (lo + hi) / 2;
			for(int j=lo; j<=mid; j++) if(d[j] == -1) s[j] ^= 1;
			int vl = tryCombination(s);
			if((vl != i and lst != i) or (vl == i and lst == i)) lo = mid + 1;
			else hi = mid;
			lst = vl;
		}
		d[lo] = i;
		if(lst == i) s[lo] ^= 1;
		lst = tryCombination(s);
	}
	
	answer(s, d);
}

Compilation message (stderr)

cave.cpp: In function 'void exploreCave(int)':
cave.cpp:37:27: error: cannot convert 'vi' {aka 'std::vector<int>'} to 'int*'
   37 |  int lst = tryCombination(s);
      |                           ^
      |                           |
      |                           vi {aka 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:28: error: cannot convert 'vi' {aka 'std::vector<int>'} to 'int*'
   43 |    int vl = tryCombination(s);
      |                            ^
      |                            |
      |                            vi {aka 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:50:24: error: cannot convert 'vi' {aka 'std::vector<int>'} to 'int*'
   50 |   lst = tryCombination(s);
      |                        ^
      |                        |
      |                        vi {aka 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:53:9: error: cannot convert 'vi' {aka 'std::vector<int>'} to 'int*'
   53 |  answer(s, d);
      |         ^
      |         |
      |         vi {aka 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[]);
      |             ~~~~^~~