Submission #937844

# Submission time Handle Problem Language Result Execution time Memory
937844 2024-03-04T15:17:47 Z Macker The Big Prize (IOI17_prize) C++14
0 / 100
3 ms 432 KB
#include "prize.h"
#include <bits/stdc++.h>

typedef long long ll;
#define all(v) v.begin(), v.end()
#define FOR(i, n) for (int i = 0; i < n; i++)

using namespace std;

int find_best(int n) {
	int mn = 0;
	FOR(i, min(500, n)){
		auto res = ask(i);
		mn = max(mn, res[0] + res[1]);
	}
	vector<int> pos;
	int l = 0, r = 1;
	FOR(i, mn){
		while(1){
			auto ret = ask(r);
			if(ret[0] + ret[1] != mn) break;
			if(ret[0] > i) break;
			r += (r - l); 
		}
		while(l < r){
			int mid = (l + r) / 2;
			auto ret = ask(mid);
			if(ret[0] + ret[1] != mn) r = mid;
			else if(ret[0] > i) r = mid - 1;
			else l = mid + 1;
		}
		pos.push_back(l);
		r++;
	}
	for (auto i : pos) {
		auto ret = ask(i);
		if(ret[0] + ret[1] == 0) return i;
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 3 ms 344 KB Output is correct
3 Correct 2 ms 344 KB Output is correct
4 Incorrect 2 ms 432 KB Integer 262144 violates the range [0, 199999]
5 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 2 ms 344 KB Output is correct
3 Correct 2 ms 344 KB Output is correct
4 Incorrect 3 ms 432 KB Integer 262144 violates the range [0, 199999]
5 Halted 0 ms 0 KB -