Submission #937879

# Submission time Handle Problem Language Result Execution time Memory
937879 2024-03-04T15:55:12 Z Macker The Big Prize (IOI17_prize) C++17
90 / 100
63 ms 6456 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(r);
		if(r != n - 1) {l++; r += 2;}
	}
	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 4 ms 5040 KB Output is correct
2 Correct 5 ms 5060 KB Output is correct
3 Correct 4 ms 5044 KB Output is correct
4 Correct 5 ms 5040 KB Output is correct
5 Correct 5 ms 5048 KB Output is correct
6 Correct 3 ms 5044 KB Output is correct
7 Correct 6 ms 5040 KB Output is correct
8 Correct 4 ms 5044 KB Output is correct
9 Correct 4 ms 4952 KB Output is correct
10 Correct 4 ms 5048 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 5040 KB Output is correct
2 Correct 5 ms 5048 KB Output is correct
3 Correct 4 ms 5040 KB Output is correct
4 Correct 5 ms 5044 KB Output is correct
5 Correct 4 ms 5044 KB Output is correct
6 Correct 3 ms 5044 KB Output is correct
7 Correct 4 ms 5044 KB Output is correct
8 Correct 4 ms 5016 KB Output is correct
9 Correct 5 ms 5044 KB Output is correct
10 Correct 4 ms 5052 KB Output is correct
11 Correct 9 ms 5148 KB Output is correct
12 Correct 9 ms 5156 KB Output is correct
13 Correct 9 ms 5156 KB Output is correct
14 Correct 10 ms 1456 KB Output is correct
15 Partially correct 36 ms 5960 KB Partially correct - number of queries: 8732
16 Partially correct 35 ms 5696 KB Partially correct - number of queries: 7719
17 Partially correct 42 ms 5716 KB Partially correct - number of queries: 9210
18 Partially correct 42 ms 5932 KB Partially correct - number of queries: 9200
19 Correct 3 ms 5044 KB Output is correct
20 Correct 12 ms 3080 KB Output is correct
21 Partially correct 44 ms 5740 KB Partially correct - number of queries: 9270
22 Partially correct 34 ms 5728 KB Partially correct - number of queries: 7669
23 Correct 6 ms 5044 KB Output is correct
24 Correct 6 ms 5040 KB Output is correct
25 Partially correct 43 ms 5732 KB Partially correct - number of queries: 8828
26 Correct 22 ms 5932 KB Output is correct
27 Correct 6 ms 5044 KB Output is correct
28 Partially correct 45 ms 5548 KB Partially correct - number of queries: 8207
29 Partially correct 42 ms 6216 KB Partially correct - number of queries: 7518
30 Partially correct 42 ms 5676 KB Partially correct - number of queries: 9052
31 Partially correct 54 ms 5996 KB Partially correct - number of queries: 9047
32 Correct 8 ms 5292 KB Output is correct
33 Correct 1 ms 432 KB Output is correct
34 Correct 13 ms 5944 KB Output is correct
35 Correct 6 ms 5040 KB Output is correct
36 Correct 14 ms 5404 KB Output is correct
37 Correct 5 ms 5144 KB Output is correct
38 Correct 4 ms 5048 KB Output is correct
39 Partially correct 43 ms 5996 KB Partially correct - number of queries: 9258
40 Partially correct 42 ms 5964 KB Partially correct - number of queries: 7871
41 Partially correct 30 ms 5924 KB Partially correct - number of queries: 5640
42 Partially correct 24 ms 5416 KB Partially correct - number of queries: 5640
43 Partially correct 34 ms 5556 KB Partially correct - number of queries: 5126
44 Correct 15 ms 5664 KB Output is correct
45 Correct 12 ms 5680 KB Output is correct
46 Partially correct 53 ms 5660 KB Partially correct - number of queries: 9217
47 Correct 18 ms 5672 KB Output is correct
48 Partially correct 33 ms 5952 KB Partially correct - number of queries: 6703
49 Partially correct 61 ms 5464 KB Partially correct - number of queries: 9275
50 Partially correct 49 ms 5952 KB Partially correct - number of queries: 9218
51 Correct 19 ms 5172 KB Output is correct
52 Partially correct 46 ms 5672 KB Partially correct - number of queries: 9205
53 Correct 5 ms 5044 KB Output is correct
54 Correct 18 ms 5664 KB Output is correct
55 Partially correct 38 ms 5964 KB Partially correct - number of queries: 9221
56 Partially correct 41 ms 5952 KB Partially correct - number of queries: 9205
57 Partially correct 33 ms 5940 KB Partially correct - number of queries: 6626
58 Partially correct 39 ms 6188 KB Partially correct - number of queries: 6759
59 Partially correct 30 ms 5416 KB Partially correct - number of queries: 5640
60 Partially correct 45 ms 5568 KB Partially correct - number of queries: 9203
61 Correct 5 ms 5044 KB Output is correct
62 Correct 4 ms 5044 KB Output is correct
63 Correct 5 ms 5044 KB Output is correct
64 Correct 5 ms 5296 KB Output is correct
65 Correct 4 ms 5036 KB Output is correct
66 Correct 8 ms 5416 KB Output is correct
67 Correct 5 ms 5048 KB Output is correct
68 Correct 9 ms 5156 KB Output is correct
69 Correct 6 ms 5560 KB Output is correct
70 Correct 4 ms 5044 KB Output is correct
71 Partially correct 41 ms 5996 KB Partially correct - number of queries: 9166
72 Correct 7 ms 5292 KB Output is correct
73 Partially correct 38 ms 5492 KB Partially correct - number of queries: 9063
74 Partially correct 52 ms 5976 KB Partially correct - number of queries: 9108
75 Correct 5 ms 5296 KB Output is correct
76 Partially correct 38 ms 5696 KB Partially correct - number of queries: 8090
77 Partially correct 47 ms 6220 KB Partially correct - number of queries: 9141
78 Correct 7 ms 5556 KB Output is correct
79 Correct 25 ms 5684 KB Output is correct
80 Partially correct 45 ms 5692 KB Partially correct - number of queries: 9120
81 Partially correct 63 ms 5828 KB Partially correct - number of queries: 9093
82 Partially correct 40 ms 6236 KB Partially correct - number of queries: 9023
83 Correct 6 ms 5044 KB Output is correct
84 Partially correct 33 ms 6456 KB Partially correct - number of queries: 7779
85 Partially correct 45 ms 6224 KB Partially correct - number of queries: 9126
86 Correct 7 ms 5300 KB Output is correct
87 Correct 4 ms 5044 KB Output is correct
88 Correct 8 ms 5304 KB Output is correct
89 Correct 7 ms 5040 KB Output is correct
90 Correct 4 ms 5048 KB Output is correct
91 Correct 6 ms 5040 KB Output is correct
92 Correct 7 ms 5304 KB Output is correct
93 Correct 11 ms 5312 KB Output is correct
94 Correct 13 ms 5304 KB Output is correct
95 Correct 9 ms 5564 KB Output is correct
96 Correct 8 ms 5668 KB Output is correct
97 Correct 7 ms 5156 KB Output is correct