Submission #134391

# Submission time Handle Problem Language Result Execution time Memory
134391 2019-07-22T15:09:53 Z rondojim The Big Prize (IOI17_prize) C++17
0 / 100
95 ms 5260 KB
#include "prize.h"
#include <bits/stdc++.h>

using namespace std;

const int N = 200000, buk = 480;
 
vector<int> res[N];
int n, mx = -1;

vector<int> ASK(int p){
	if(res[p].size()) return res[p];
	return res[p] = ask(p);
}
 
int FIND(int l,int r){
	if(l == r){
		vector<int> tmp = ASK(l);
		if(tmp[0] == 0 && tmp[1] == 0) return l;
		return -1;
	}
	vector<int> tmp1, tmp2;
	tmp1 = ASK(l);
	tmp2 = ASK(r);
	if(tmp1[0] == 0 && tmp1[1] == 0) return l;
	if(tmp2[0] == 0 && tmp2[1] == 0) return r;
	int md = (l+r)/2;
	//if(tmp1 == tmp2) return -1;
	int t = FIND(l,md);
	int t2 = FIND(md+1,r);
	if(t != -1) return t;
	return t2;
}
 
 
int find_best(int _N) {
	n = _N;
	return FIND(0,n - 1);
}
# Verdict Execution time Memory Grader output
1 Incorrect 95 ms 5208 KB Incorrect
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 91 ms 5260 KB Incorrect
2 Halted 0 ms 0 KB -