Submission #1028641

# Submission time Handle Problem Language Result Execution time Memory
1028641 2024-07-20T06:36:08 Z DorostWef The Big Prize (IOI17_prize) C++17
94.94 / 100
44 ms 596 KB
#include "prize.h"
#include <bits/stdc++.h>

using namespace std;

int cnt;

int solve (int l, int r, int cl, int cr) {
	if (l > r || cl + cr == cnt)
		return 0;
	if (l == r) {
		vector<int> a = ask(l);
		if (a[0] + a[1] == 0)
			return l;
		return 0;
	}
	int mid = (l + r) >> 1;
	int mn = mid, mx = mid;
	for (int i = 0; i < (r - l + 1); i++) {
		int x;
		if (i % 2 == 1) {
			x = mid + i / 2 + 1;
		} else {
			x = mid - i / 2;
		}
		mn = min (mn, x);
		mx = max (mx, x);
		vector<int> a = ask(x);
		if (a[0] + a[1] == 0)
			return x;
		if (a[0] + a[1] == cnt) {
			return solve (l, mn - 1, cl, a[1]) ^ solve (mx + 1, r, a[0], cr);
		}
	}
	return 0;
}

int find_best(int n) {
	for (int i = 0; i < min (n, 500); i++) {
		vector<int> a = ask(i);
		if(a[0] + a[1] == 0)
			return i;
		cnt = max (cnt, a[0] + a[1]);
	}
	return solve (0, n - 1, 0, 0);
}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 344 KB Output is correct
2 Correct 4 ms 344 KB Output is correct
3 Correct 2 ms 344 KB Output is correct
4 Correct 3 ms 344 KB Output is correct
5 Correct 4 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 4 ms 344 KB Output is correct
8 Correct 3 ms 344 KB Output is correct
9 Correct 4 ms 344 KB Output is correct
10 Correct 3 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 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 Correct 4 ms 344 KB Output is correct
5 Correct 3 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 3 ms 344 KB Output is correct
8 Correct 3 ms 344 KB Output is correct
9 Correct 3 ms 344 KB Output is correct
10 Correct 3 ms 344 KB Output is correct
11 Correct 3 ms 344 KB Output is correct
12 Correct 3 ms 344 KB Output is correct
13 Correct 3 ms 344 KB Output is correct
14 Correct 10 ms 344 KB Output is correct
15 Partially correct 22 ms 344 KB Partially correct - number of queries: 5189
16 Partially correct 27 ms 344 KB Partially correct - number of queries: 5415
17 Correct 2 ms 344 KB Output is correct
18 Partially correct 32 ms 344 KB Partially correct - number of queries: 5407
19 Correct 2 ms 344 KB Output is correct
20 Correct 16 ms 344 KB Output is correct
21 Partially correct 26 ms 344 KB Partially correct - number of queries: 5382
22 Correct 19 ms 344 KB Output is correct
23 Correct 3 ms 344 KB Output is correct
24 Correct 4 ms 344 KB Output is correct
25 Partially correct 25 ms 344 KB Partially correct - number of queries: 5056
26 Partially correct 19 ms 344 KB Partially correct - number of queries: 5032
27 Correct 3 ms 344 KB Output is correct
28 Correct 25 ms 344 KB Output is correct
29 Correct 25 ms 596 KB Output is correct
30 Partially correct 39 ms 344 KB Partially correct - number of queries: 5378
31 Correct 2 ms 344 KB Output is correct
32 Correct 5 ms 344 KB Output is correct
33 Correct 0 ms 344 KB Output is correct
34 Partially correct 24 ms 344 KB Partially correct - number of queries: 5402
35 Correct 3 ms 344 KB Output is correct
36 Partially correct 28 ms 344 KB Partially correct - number of queries: 5389
37 Correct 4 ms 344 KB Output is correct
38 Correct 2 ms 344 KB Output is correct
39 Partially correct 27 ms 344 KB Partially correct - number of queries: 5392
40 Correct 19 ms 344 KB Output is correct
41 Partially correct 21 ms 344 KB Partially correct - number of queries: 5429
42 Partially correct 26 ms 344 KB Partially correct - number of queries: 5429
43 Partially correct 23 ms 344 KB Partially correct - number of queries: 5277
44 Partially correct 30 ms 344 KB Partially correct - number of queries: 5412
45 Partially correct 31 ms 344 KB Partially correct - number of queries: 5040
46 Correct 3 ms 344 KB Output is correct
47 Partially correct 26 ms 344 KB Partially correct - number of queries: 5050
48 Partially correct 30 ms 344 KB Partially correct - number of queries: 5413
49 Partially correct 27 ms 344 KB Partially correct - number of queries: 5413
50 Partially correct 31 ms 344 KB Partially correct - number of queries: 5423
51 Partially correct 41 ms 344 KB Partially correct - number of queries: 5422
52 Partially correct 18 ms 344 KB Partially correct - number of queries: 5428
53 Correct 2 ms 344 KB Output is correct
54 Partially correct 21 ms 344 KB Partially correct - number of queries: 5374
55 Correct 2 ms 344 KB Output is correct
56 Partially correct 37 ms 344 KB Partially correct - number of queries: 5418
57 Partially correct 21 ms 344 KB Partially correct - number of queries: 5383
58 Partially correct 23 ms 344 KB Partially correct - number of queries: 5417
59 Partially correct 37 ms 344 KB Partially correct - number of queries: 5430
60 Partially correct 25 ms 344 KB Partially correct - number of queries: 5370
61 Correct 3 ms 344 KB Output is correct
62 Correct 3 ms 344 KB Output is correct
63 Correct 3 ms 344 KB Output is correct
64 Correct 3 ms 344 KB Output is correct
65 Correct 3 ms 428 KB Output is correct
66 Correct 5 ms 344 KB Output is correct
67 Correct 2 ms 340 KB Output is correct
68 Correct 2 ms 344 KB Output is correct
69 Correct 4 ms 344 KB Output is correct
70 Correct 3 ms 344 KB Output is correct
71 Partially correct 20 ms 344 KB Partially correct - number of queries: 5259
72 Correct 6 ms 344 KB Output is correct
73 Partially correct 31 ms 344 KB Partially correct - number of queries: 5196
74 Partially correct 20 ms 344 KB Partially correct - number of queries: 5223
75 Correct 3 ms 344 KB Output is correct
76 Correct 22 ms 344 KB Output is correct
77 Partially correct 31 ms 344 KB Partially correct - number of queries: 5506
78 Correct 5 ms 344 KB Output is correct
79 Correct 14 ms 344 KB Output is correct
80 Partially correct 39 ms 344 KB Partially correct - number of queries: 5495
81 Partially correct 44 ms 344 KB Partially correct - number of queries: 5477
82 Partially correct 26 ms 344 KB Partially correct - number of queries: 5460
83 Correct 3 ms 344 KB Output is correct
84 Correct 27 ms 344 KB Output is correct
85 Partially correct 31 ms 344 KB Partially correct - number of queries: 5506
86 Correct 4 ms 344 KB Output is correct
87 Correct 4 ms 344 KB Output is correct
88 Correct 5 ms 344 KB Output is correct
89 Correct 5 ms 344 KB Output is correct
90 Correct 3 ms 344 KB Output is correct
91 Correct 4 ms 424 KB Output is correct
92 Correct 5 ms 344 KB Output is correct
93 Correct 7 ms 344 KB Output is correct
94 Correct 6 ms 344 KB Output is correct
95 Correct 6 ms 344 KB Output is correct
96 Correct 8 ms 344 KB Output is correct
97 Correct 6 ms 344 KB Output is correct