답안 #135660

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
135660 2019-07-24T09:31:19 Z win11905 커다란 상품 (IOI17_prize) C++11
90 / 100
92 ms 508 KB
#include <bits/stdc++.h>
#include "prize.h"
using namespace std;

int con = 500;

int find_best(int n) {
	if(n < con) {
		for(int i = 0; i < n; ++i) {
			vector<int> ret = ask(i);
			if(ret[0] + ret[1] == 0) return i;
		}
	}
	int mx = 0;
	for(int i = 0; i < con; ++i) {
		vector<int> ret = ask(i);
		mx = max(mx, ret[0] + ret[1]);
		if(ret[0] + ret[1] == 0) return i;
	}
	int ptr = con;
	while(ptr < n) {
		vector<int> ret = ask(ptr);
		if(ret[0] + ret[1] == 0) return ptr;
		if(ret[0] + ret[1] == mx) {
			int l = ptr, r = n-1;
			while(l < r) {
				int m = (l + r + 1) >> 1;
				if(ret == ask(m)) l = m;
				else r = m-1;
			}
			ptr = l;
		}
		ptr++;
	}
	return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 376 KB Output is correct
2 Correct 7 ms 388 KB Output is correct
3 Correct 4 ms 376 KB Output is correct
4 Correct 5 ms 376 KB Output is correct
5 Correct 7 ms 248 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 8 ms 248 KB Output is correct
8 Correct 4 ms 376 KB Output is correct
9 Correct 4 ms 376 KB Output is correct
10 Correct 6 ms 380 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 376 KB Output is correct
2 Correct 7 ms 376 KB Output is correct
3 Correct 7 ms 308 KB Output is correct
4 Correct 4 ms 396 KB Output is correct
5 Correct 7 ms 248 KB Output is correct
6 Correct 2 ms 396 KB Output is correct
7 Correct 6 ms 248 KB Output is correct
8 Correct 6 ms 376 KB Output is correct
9 Correct 4 ms 376 KB Output is correct
10 Correct 5 ms 392 KB Output is correct
11 Correct 11 ms 252 KB Output is correct
12 Correct 10 ms 376 KB Output is correct
13 Correct 8 ms 508 KB Output is correct
14 Correct 10 ms 248 KB Output is correct
15 Correct 20 ms 248 KB Output is correct
16 Partially correct 40 ms 308 KB Partially correct - number of queries: 7814
17 Correct 4 ms 504 KB Output is correct
18 Partially correct 84 ms 248 KB Partially correct - number of queries: 9090
19 Correct 4 ms 376 KB Output is correct
20 Correct 29 ms 252 KB Output is correct
21 Correct 45 ms 248 KB Output is correct
22 Correct 15 ms 252 KB Output is correct
23 Correct 7 ms 308 KB Output is correct
24 Correct 4 ms 376 KB Output is correct
25 Partially correct 31 ms 392 KB Partially correct - number of queries: 5333
26 Partially correct 56 ms 372 KB Partially correct - number of queries: 5269
27 Correct 13 ms 504 KB Output is correct
28 Partially correct 76 ms 312 KB Partially correct - number of queries: 8648
29 Partially correct 61 ms 248 KB Partially correct - number of queries: 6688
30 Partially correct 82 ms 308 KB Partially correct - number of queries: 9032
31 Correct 6 ms 376 KB Output is correct
32 Correct 14 ms 304 KB Output is correct
33 Correct 2 ms 248 KB Output is correct
34 Correct 30 ms 248 KB Output is correct
35 Correct 5 ms 376 KB Output is correct
36 Correct 27 ms 312 KB Output is correct
37 Correct 6 ms 392 KB Output is correct
38 Correct 7 ms 248 KB Output is correct
39 Correct 49 ms 312 KB Output is correct
40 Partially correct 78 ms 296 KB Partially correct - number of queries: 7787
41 Partially correct 66 ms 376 KB Partially correct - number of queries: 5629
42 Partially correct 65 ms 248 KB Partially correct - number of queries: 5629
43 Partially correct 40 ms 388 KB Partially correct - number of queries: 5129
44 Correct 41 ms 248 KB Output is correct
45 Correct 49 ms 248 KB Output is correct
46 Correct 4 ms 308 KB Output is correct
47 Correct 49 ms 308 KB Output is correct
48 Partially correct 59 ms 248 KB Partially correct - number of queries: 6846
49 Correct 13 ms 376 KB Output is correct
50 Partially correct 92 ms 248 KB Partially correct - number of queries: 9087
51 Correct 22 ms 396 KB Output is correct
52 Correct 7 ms 304 KB Output is correct
53 Correct 6 ms 304 KB Output is correct
54 Correct 27 ms 376 KB Output is correct
55 Correct 5 ms 376 KB Output is correct
56 Partially correct 80 ms 308 KB Partially correct - number of queries: 9089
57 Partially correct 36 ms 308 KB Partially correct - number of queries: 6768
58 Partially correct 37 ms 316 KB Partially correct - number of queries: 6874
59 Partially correct 41 ms 308 KB Partially correct - number of queries: 5629
60 Partially correct 30 ms 392 KB Partially correct - number of queries: 5260
61 Correct 5 ms 308 KB Output is correct
62 Correct 5 ms 304 KB Output is correct
63 Correct 5 ms 376 KB Output is correct
64 Correct 5 ms 312 KB Output is correct
65 Correct 4 ms 316 KB Output is correct
66 Correct 7 ms 376 KB Output is correct
67 Correct 7 ms 308 KB Output is correct
68 Correct 7 ms 248 KB Output is correct
69 Correct 10 ms 308 KB Output is correct
70 Correct 7 ms 308 KB Output is correct
71 Partially correct 79 ms 388 KB Partially correct - number of queries: 9228
72 Correct 14 ms 308 KB Output is correct
73 Partially correct 47 ms 308 KB Partially correct - number of queries: 9112
74 Partially correct 85 ms 376 KB Partially correct - number of queries: 9164
75 Correct 9 ms 248 KB Output is correct
76 Partially correct 79 ms 304 KB Partially correct - number of queries: 7960
77 Partially correct 55 ms 376 KB Partially correct - number of queries: 9112
78 Correct 13 ms 296 KB Output is correct
79 Correct 42 ms 248 KB Output is correct
80 Partially correct 85 ms 276 KB Partially correct - number of queries: 9138
81 Partially correct 48 ms 376 KB Partially correct - number of queries: 9101
82 Partially correct 87 ms 308 KB Partially correct - number of queries: 9032
83 Correct 5 ms 304 KB Output is correct
84 Partially correct 58 ms 248 KB Partially correct - number of queries: 7495
85 Partially correct 82 ms 304 KB Partially correct - number of queries: 9103
86 Correct 5 ms 424 KB Output is correct
87 Correct 5 ms 308 KB Output is correct
88 Correct 8 ms 252 KB Output is correct
89 Correct 6 ms 248 KB Output is correct
90 Correct 6 ms 304 KB Output is correct
91 Correct 8 ms 304 KB Output is correct
92 Correct 8 ms 376 KB Output is correct
93 Correct 7 ms 256 KB Output is correct
94 Correct 7 ms 388 KB Output is correct
95 Correct 13 ms 376 KB Output is correct
96 Correct 6 ms 248 KB Output is correct
97 Correct 4 ms 268 KB Output is correct