Submission #64601

# Submission time Handle Problem Language Result Execution time Memory
64601 2018-08-05T03:05:26 Z nvmdava The Big Prize (IOI17_prize) C++14
0 / 100
15 ms 5300 KB
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;
 
 
vector<int> ans[210000];
int mx = -1;

int find_best(int n) {
	
	for(int i = 0; i < 500; i++){
		ans[i] = ask(i);
		if(ans[i][0] + ans[i][1] == 0){
			return i;
		}
		mx = max(mx, ans[i][0] + ans[i][1]);
	}
	int id = 0;
	while(id < n){	
		while(ans[id][0] + ans[id][1] != mx){
			id++;
			ans[id]  = ask(id);
			if(ans[id][0] + ans[id][1] == 0) return id;
		}
		int l = id, r = n - 1;
		int k = 0;
		while(l <= r)
		{
			int m = (l + r) >> 1;
			ans[m] = ask(m);
			if(ans[m][1] != ans[id][1] || ans[m][0] + ans[m][1] < mx) r = m - 1;
			else {
				l = m + 1;
				k = m;
			}
		}
		id = k + 1;
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 12 ms 5240 KB answer is not correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 5300 KB answer is not correct
2 Halted 0 ms 0 KB -