Submission #64600

# Submission time Handle Problem Language Result Execution time Memory
64600 2018-08-05T03:04:48 Z nvmdava The Big Prize (IOI17_prize) C++17
0 / 100
14 ms 5304 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;
	}
}

Compilation message

prize.cpp: In function 'int find_best(int)':
prize.cpp:39:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 5240 KB Integer 200000 violates the range [0, 199999]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 14 ms 5304 KB Integer 200000 violates the range [0, 199999]
2 Halted 0 ms 0 KB -