Submission #937859

# Submission time Handle Problem Language Result Execution time Memory
937859 2024-03-04T15:38:41 Z Macker The Big Prize (IOI17_prize) C++17
20 / 100
52 ms 6088 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(530, n)){
		auto res = ask(i);
		mn = max(mn, res[0] + res[1]);
	}
	vector<int> pos;
	vector<vector<int>> val(n);
	int l = 0, r = 1;
	FOR(i, mn){
		while(r < n - 1){
			auto ret = ask(r);
			if(ret[0] + ret[1] != mn) break;
			if(ret[0] > i) break;
			r += (r - l); 
			if(r >= n){
				r = n - 1;
				break;
			}
		}
		while(l < r){
			int mid = (l + r) / 2;
			vector<int> ret;
			if(val[mid].size()) ret = val[mid];
			else ret = val[mid] = ask(mid);

			if(ret[0] + ret[1] == 0) return 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);
		if(r != n - 1) r++;
	}
	for (auto i : pos) {
		vector<int> ret;
		if(val[i].size()) ret = val[i];
		else ret = val[i] = ask(i);
		if(ret[0] + ret[1] == 0) return i;
	}
	return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 5044 KB Output is correct
2 Correct 3 ms 5044 KB Output is correct
3 Correct 4 ms 5040 KB Output is correct
4 Correct 4 ms 5044 KB Output is correct
5 Correct 3 ms 5040 KB Output is correct
6 Correct 4 ms 5044 KB Output is correct
7 Correct 3 ms 5048 KB Output is correct
8 Correct 4 ms 5044 KB Output is correct
9 Correct 5 ms 5040 KB Output is correct
10 Correct 4 ms 5040 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 5044 KB Output is correct
2 Correct 4 ms 5040 KB Output is correct
3 Correct 4 ms 5040 KB Output is correct
4 Correct 4 ms 5040 KB Output is correct
5 Correct 4 ms 5044 KB Output is correct
6 Correct 4 ms 5048 KB Output is correct
7 Correct 3 ms 5044 KB Output is correct
8 Correct 5 ms 5044 KB Output is correct
9 Correct 4 ms 5048 KB Output is correct
10 Correct 3 ms 5044 KB Output is correct
11 Correct 7 ms 5304 KB Output is correct
12 Correct 8 ms 5400 KB Output is correct
13 Correct 7 ms 5156 KB Output is correct
14 Correct 3 ms 948 KB Output is correct
15 Correct 12 ms 5668 KB Output is correct
16 Partially correct 52 ms 5972 KB Partially correct - number of queries: 9464
17 Partially correct 42 ms 5692 KB Partially correct - number of queries: 9315
18 Partially correct 43 ms 5512 KB Partially correct - number of queries: 9498
19 Correct 4 ms 5048 KB Output is correct
20 Partially correct 29 ms 3596 KB Partially correct - number of queries: 6571
21 Correct 15 ms 5432 KB Output is correct
22 Correct 8 ms 5300 KB Output is correct
23 Correct 4 ms 5044 KB Output is correct
24 Correct 4 ms 5044 KB Output is correct
25 Incorrect 25 ms 6088 KB answer is not correct
26 Halted 0 ms 0 KB -