Submission #633924

# Submission time Handle Problem Language Result Execution time Memory
633924 2022-08-23T12:58:38 Z pulsatio Toy Train (IOI17_train) C++14
Compilation error
0 ms 0 KB
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;
int ans = -1,c = 0;
const int MAX = 2e5 + 1;

vector<int> v[MAX];

void as(int i){
	if(v[i].size() != 0) return;

	v[i] = ask(i);
	
	if(v[i][0] + v[i][1] == 0)
		ans = i;

}

bool is(int i){
	if(v[i].size() == 0) as(i);
//	cout <<  i << " " <<  v[i][0] << " " << v[i][1] << endl;
	if(v[i][0] + v[i][1]  == c)
		return true;
	return false;
}

void solve(int l,int r,int cur = 0){
//	cout << l << " " << r << endl;
	if(ans != -1) return;
	while(!is(l) && l < r) l++;
	if(ans != -1) return ;
//	cout << r << endl;
	while(!is(r) && l < r) r--;
//	cout << r << endl;
	if(ans != -1) return;
	int mid = (l+r)/2;
	if(l >= r || v[r][0] == v[l][0]) return;
	solve(l,mid);
	solve(mid+1,r);
}

int find_best(int n) {
	for(int i = 0; i < min(500,n); i++){
		as(i);
		c = max(c,v[i][0] + v[i][1]);
	}	
	solve(0,n-1);
	return ans;
}
 

Compilation message

train.cpp:1:10: fatal error: prize.h: No such file or directory
    1 | #include "prize.h"
      |          ^~~~~~~~~
compilation terminated.