답안 #1069294

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1069294 2024-08-21T18:53:00 Z MinaRagy06 커다란 상품 (IOI17_prize) C++17
90 / 100
66 ms 6292 KB
#include <bits/stdc++.h>
#include "prize.h"
using namespace std;
#define ll long long
#define SZ(x) (int) x.size()

const int N = 200'005;
vector<int> asked[N];
int cnt;
vector<int> get(int i) {
	if (SZ(asked[i])) {
		return asked[i];
	}
	cnt++;
	assert(cnt <= 10'000);
	return asked[i] = ask(i);
}
int solve(int l, int r) {
	while (l <= r && get(l)[0] + get(l)[1] != get(r)[0] + get(r)[1]) {
		vector<int> vl = get(l), vr = get(r);
		if (vl[0] + vl[1] < vr[0] + vr[1]) {
			if (vl[0] + vl[1] == 0) {
				return l;
			}
			l++;
		} else {
			if (vr[0] + vr[1] == 0) {
				return r;
			}
			r--;
		}
	}
	if (l > r) return -1;
	vector<int> vl = get(l), vr = get(r);
	if (vl == vr) {
		vector<int> v = get(l);
		if (v[0] + v[1] == 0) {
			return l;
		}
		return -1;
	}
	return max(solve(l, (l + r) / 2), solve((l + r) / 2 + 1, r));
}
int find_best(int n) {
	return solve(0, n - 1);
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4952 KB Output is correct
2 Correct 2 ms 5124 KB Output is correct
3 Correct 1 ms 4952 KB Output is correct
4 Correct 2 ms 4952 KB Output is correct
5 Correct 1 ms 4952 KB Output is correct
6 Correct 2 ms 4952 KB Output is correct
7 Correct 2 ms 4952 KB Output is correct
8 Correct 1 ms 5132 KB Output is correct
9 Correct 1 ms 4952 KB Output is correct
10 Correct 2 ms 4952 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 4952 KB Output is correct
2 Correct 1 ms 4952 KB Output is correct
3 Correct 2 ms 4952 KB Output is correct
4 Correct 1 ms 4952 KB Output is correct
5 Correct 1 ms 4952 KB Output is correct
6 Correct 1 ms 4952 KB Output is correct
7 Correct 1 ms 4952 KB Output is correct
8 Correct 2 ms 4952 KB Output is correct
9 Correct 1 ms 4952 KB Output is correct
10 Correct 2 ms 5208 KB Output is correct
11 Correct 5 ms 4952 KB Output is correct
12 Correct 5 ms 4952 KB Output is correct
13 Correct 5 ms 4952 KB Output is correct
14 Correct 9 ms 4952 KB Output is correct
15 Partially correct 27 ms 5456 KB Partially correct - number of queries: 7058
16 Partially correct 52 ms 5212 KB Partially correct - number of queries: 7471
17 Partially correct 45 ms 5208 KB Partially correct - number of queries: 7466
18 Partially correct 53 ms 5456 KB Partially correct - number of queries: 7519
19 Partially correct 37 ms 6292 KB Partially correct - number of queries: 7126
20 Correct 35 ms 5208 KB Output is correct
21 Partially correct 41 ms 5520 KB Partially correct - number of queries: 7448
22 Partially correct 30 ms 5260 KB Partially correct - number of queries: 5785
23 Correct 3 ms 4952 KB Output is correct
24 Correct 5 ms 4952 KB Output is correct
25 Partially correct 44 ms 5304 KB Partially correct - number of queries: 6782
26 Partially correct 38 ms 5200 KB Partially correct - number of queries: 6679
27 Correct 2 ms 4952 KB Output is correct
28 Partially correct 44 ms 5472 KB Partially correct - number of queries: 6744
29 Partially correct 36 ms 5408 KB Partially correct - number of queries: 5688
30 Partially correct 38 ms 5520 KB Partially correct - number of queries: 7475
31 Partially correct 41 ms 5200 KB Partially correct - number of queries: 7397
32 Correct 5 ms 4952 KB Output is correct
33 Correct 2 ms 4952 KB Output is correct
34 Partially correct 47 ms 5452 KB Partially correct - number of queries: 7508
35 Correct 4 ms 4952 KB Output is correct
36 Partially correct 32 ms 5456 KB Partially correct - number of queries: 7553
37 Correct 8 ms 5140 KB Output is correct
38 Correct 2 ms 4952 KB Output is correct
39 Partially correct 66 ms 5404 KB Partially correct - number of queries: 7477
40 Partially correct 53 ms 5544 KB Partially correct - number of queries: 6512
41 Partially correct 39 ms 5208 KB Partially correct - number of queries: 7493
42 Partially correct 62 ms 5456 KB Partially correct - number of queries: 7493
43 Partially correct 40 ms 5208 KB Partially correct - number of queries: 7299
44 Partially correct 48 ms 5404 KB Partially correct - number of queries: 7471
45 Partially correct 38 ms 5660 KB Partially correct - number of queries: 6687
46 Partially correct 44 ms 5464 KB Partially correct - number of queries: 7511
47 Partially correct 45 ms 5396 KB Partially correct - number of queries: 6807
48 Partially correct 47 ms 5540 KB Partially correct - number of queries: 7475
49 Partially correct 46 ms 5760 KB Partially correct - number of queries: 7548
50 Partially correct 29 ms 5344 KB Partially correct - number of queries: 7479
51 Partially correct 42 ms 5556 KB Partially correct - number of queries: 7488
52 Partially correct 36 ms 5456 KB Partially correct - number of queries: 7544
53 Correct 2 ms 5144 KB Output is correct
54 Partially correct 40 ms 5488 KB Partially correct - number of queries: 7462
55 Partially correct 54 ms 5408 KB Partially correct - number of queries: 7521
56 Partially correct 54 ms 5416 KB Partially correct - number of queries: 7564
57 Partially correct 45 ms 5316 KB Partially correct - number of queries: 7503
58 Partially correct 49 ms 5972 KB Partially correct - number of queries: 7507
59 Partially correct 50 ms 5208 KB Partially correct - number of queries: 7535
60 Partially correct 44 ms 5712 KB Partially correct - number of queries: 7483
61 Correct 2 ms 4952 KB Output is correct
62 Correct 3 ms 4952 KB Output is correct
63 Correct 3 ms 5208 KB Output is correct
64 Correct 2 ms 4952 KB Output is correct
65 Correct 1 ms 4952 KB Output is correct
66 Correct 1 ms 4952 KB Output is correct
67 Correct 3 ms 4952 KB Output is correct
68 Correct 4 ms 4952 KB Output is correct
69 Correct 1 ms 4952 KB Output is correct
70 Correct 3 ms 4952 KB Output is correct
71 Partially correct 49 ms 5756 KB Partially correct - number of queries: 8576
72 Correct 6 ms 5208 KB Output is correct
73 Partially correct 52 ms 5532 KB Partially correct - number of queries: 8464
74 Partially correct 60 ms 5312 KB Partially correct - number of queries: 8512
75 Correct 3 ms 4952 KB Output is correct
76 Partially correct 39 ms 5468 KB Partially correct - number of queries: 7424
77 Partially correct 57 ms 5208 KB Partially correct - number of queries: 7533
78 Correct 6 ms 5148 KB Output is correct
79 Correct 22 ms 5424 KB Output is correct
80 Partially correct 33 ms 5208 KB Partially correct - number of queries: 7448
81 Partially correct 52 ms 5456 KB Partially correct - number of queries: 7445
82 Partially correct 57 ms 5712 KB Partially correct - number of queries: 7457
83 Correct 4 ms 4952 KB Output is correct
84 Partially correct 23 ms 5472 KB Partially correct - number of queries: 6211
85 Partially correct 38 ms 5544 KB Partially correct - number of queries: 7529
86 Correct 3 ms 4952 KB Output is correct
87 Correct 2 ms 4952 KB Output is correct
88 Correct 2 ms 4948 KB Output is correct
89 Correct 2 ms 4952 KB Output is correct
90 Correct 2 ms 4952 KB Output is correct
91 Correct 2 ms 4952 KB Output is correct
92 Correct 1 ms 4952 KB Output is correct
93 Correct 4 ms 4952 KB Output is correct
94 Correct 4 ms 4952 KB Output is correct
95 Correct 5 ms 5208 KB Output is correct
96 Correct 6 ms 4952 KB Output is correct
97 Correct 2 ms 4952 KB Output is correct