답안 #1055368

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1055368 2024-08-12T18:17:03 Z phoenix 커다란 상품 (IOI17_prize) C++17
90 / 100
53 ms 5740 KB
#include "prize.h"
#include <bits/stdc++.h>

using namespace std;

const int N = 200200;

vector<int> arr[N];

vector<int> ASK(int p) {
	if (arr[p].empty())
		arr[p] = ask(p);
	return arr[p];	
}

int sum(vector<int> a) {
	int s = 0;
	for (int c : a) s += c;
	return s;
}

int find_best(int n) {
	int i = 0;
	int val = sum(ASK(0));
	if (!val) return 0;

	while (i < n) {
		int x = sum(ASK(i));
		if (!x) 
			return i;
		
		if (x < val)
			i++;
		else {
			int l = i, r = n;
			while (r - l > 1) {
				int m = (l + r) / 2;
				if (ASK(m) == ASK(l))
					l = m;
				else {
					if (ASK(m)[0] + ASK(m)[1] == 0) 
						return m;
					r = m;
				} 
			}
			i = r;
		}
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4952 KB Output is correct
2 Correct 1 ms 4952 KB Output is correct
3 Correct 1 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 1 ms 5132 KB Output is correct
9 Correct 1 ms 4952 KB Output is correct
10 Correct 1 ms 4952 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4952 KB Output is correct
2 Correct 1 ms 4952 KB Output is correct
3 Correct 1 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 1 ms 4952 KB Output is correct
9 Correct 1 ms 5208 KB Output is correct
10 Correct 1 ms 4952 KB Output is correct
11 Correct 2 ms 4952 KB Output is correct
12 Correct 2 ms 4952 KB Output is correct
13 Correct 3 ms 4952 KB Output is correct
14 Correct 2 ms 5156 KB Output is correct
15 Correct 5 ms 5136 KB Output is correct
16 Partially correct 21 ms 5256 KB Partially correct - number of queries: 6747
17 Correct 1 ms 4948 KB Output is correct
18 Partially correct 33 ms 5296 KB Partially correct - number of queries: 7887
19 Correct 1 ms 4952 KB Output is correct
20 Correct 8 ms 5208 KB Output is correct
21 Correct 9 ms 5208 KB Output is correct
22 Correct 5 ms 4952 KB Output is correct
23 Correct 1 ms 4952 KB Output is correct
24 Correct 1 ms 4952 KB Output is correct
25 Correct 20 ms 5428 KB Output is correct
26 Correct 12 ms 5208 KB Output is correct
27 Correct 1 ms 4952 KB Output is correct
28 Partially correct 53 ms 5208 KB Partially correct - number of queries: 7428
29 Partially correct 36 ms 5444 KB Partially correct - number of queries: 5636
30 Partially correct 51 ms 5208 KB Partially correct - number of queries: 7844
31 Correct 1 ms 4952 KB Output is correct
32 Correct 3 ms 5208 KB Output is correct
33 Correct 1 ms 4952 KB Output is correct
34 Correct 16 ms 5156 KB Output is correct
35 Correct 1 ms 4952 KB Output is correct
36 Correct 7 ms 5388 KB Output is correct
37 Correct 2 ms 4952 KB Output is correct
38 Correct 1 ms 4952 KB Output is correct
39 Correct 15 ms 5172 KB Output is correct
40 Partially correct 30 ms 5456 KB Partially correct - number of queries: 6730
41 Correct 18 ms 5464 KB Output is correct
42 Correct 18 ms 5484 KB Output is correct
43 Correct 13 ms 5452 KB Output is correct
44 Correct 19 ms 5208 KB Output is correct
45 Correct 11 ms 5164 KB Output is correct
46 Correct 1 ms 4952 KB Output is correct
47 Correct 15 ms 5208 KB Output is correct
48 Partially correct 20 ms 5464 KB Partially correct - number of queries: 5851
49 Correct 3 ms 4952 KB Output is correct
50 Partially correct 39 ms 5464 KB Partially correct - number of queries: 7890
51 Correct 14 ms 5208 KB Output is correct
52 Correct 1 ms 4952 KB Output is correct
53 Correct 2 ms 4952 KB Output is correct
54 Correct 14 ms 5464 KB Output is correct
55 Correct 1 ms 4952 KB Output is correct
56 Partially correct 34 ms 5692 KB Partially correct - number of queries: 7890
57 Partially correct 21 ms 5244 KB Partially correct - number of queries: 5767
58 Partially correct 19 ms 5200 KB Partially correct - number of queries: 5839
59 Correct 16 ms 5188 KB Output is correct
60 Correct 14 ms 5160 KB Output is correct
61 Correct 2 ms 4952 KB Output is correct
62 Correct 1 ms 4952 KB Output is correct
63 Correct 2 ms 4952 KB Output is correct
64 Correct 1 ms 4948 KB Output is correct
65 Correct 1 ms 4952 KB Output is correct
66 Correct 3 ms 4952 KB Output is correct
67 Correct 1 ms 4952 KB Output is correct
68 Correct 2 ms 4952 KB Output is correct
69 Correct 2 ms 4952 KB Output is correct
70 Correct 1 ms 4952 KB Output is correct
71 Partially correct 42 ms 5456 KB Partially correct - number of queries: 7757
72 Correct 3 ms 4952 KB Output is correct
73 Partially correct 34 ms 5464 KB Partially correct - number of queries: 7648
74 Partially correct 37 ms 5404 KB Partially correct - number of queries: 7690
75 Correct 1 ms 4952 KB Output is correct
76 Partially correct 29 ms 5408 KB Partially correct - number of queries: 6628
77 Partially correct 34 ms 5252 KB Partially correct - number of queries: 7919
78 Correct 4 ms 4952 KB Output is correct
79 Correct 9 ms 5208 KB Output is correct
80 Partially correct 44 ms 5456 KB Partially correct - number of queries: 7911
81 Partially correct 33 ms 5208 KB Partially correct - number of queries: 7936
82 Partially correct 36 ms 5200 KB Partially correct - number of queries: 7882
83 Correct 2 ms 4952 KB Output is correct
84 Partially correct 20 ms 5208 KB Partially correct - number of queries: 6461
85 Partially correct 37 ms 5740 KB Partially correct - number of queries: 7913
86 Correct 15 ms 4952 KB Output is correct
87 Correct 3 ms 4952 KB Output is correct
88 Correct 11 ms 5208 KB Output is correct
89 Correct 7 ms 4952 KB Output is correct
90 Correct 2 ms 4952 KB Output is correct
91 Correct 3 ms 4952 KB Output is correct
92 Correct 1 ms 4952 KB Output is correct
93 Correct 3 ms 5148 KB Output is correct
94 Correct 3 ms 4952 KB Output is correct
95 Correct 3 ms 4952 KB Output is correct
96 Correct 3 ms 4952 KB Output is correct
97 Correct 1 ms 4952 KB Output is correct