Submission #135688

# Submission time Handle Problem Language Result Execution time Memory
135688 2019-07-24T09:49:06 Z win11905 The Big Prize (IOI17_prize) C++11
90 / 100
103 ms 504 KB
#include <bits/stdc++.h>
#include "prize.h"
using namespace std;

int con = 472;

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;
}
# Verdict Execution time Memory Grader output
1 Correct 7 ms 248 KB Output is correct
2 Correct 4 ms 376 KB Output is correct
3 Correct 6 ms 300 KB Output is correct
4 Correct 7 ms 248 KB Output is correct
5 Correct 4 ms 504 KB Output is correct
6 Correct 2 ms 248 KB Output is correct
7 Correct 4 ms 504 KB Output is correct
8 Correct 7 ms 248 KB Output is correct
9 Correct 6 ms 248 KB Output is correct
10 Correct 6 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 248 KB Output is correct
2 Correct 7 ms 388 KB Output is correct
3 Correct 4 ms 308 KB Output is correct
4 Correct 4 ms 376 KB Output is correct
5 Correct 4 ms 376 KB Output is correct
6 Correct 2 ms 376 KB Output is correct
7 Correct 7 ms 376 KB Output is correct
8 Correct 7 ms 308 KB Output is correct
9 Correct 6 ms 376 KB Output is correct
10 Correct 6 ms 376 KB Output is correct
11 Correct 10 ms 376 KB Output is correct
12 Correct 7 ms 292 KB Output is correct
13 Correct 12 ms 308 KB Output is correct
14 Correct 9 ms 248 KB Output is correct
15 Correct 15 ms 248 KB Output is correct
16 Partially correct 40 ms 376 KB Partially correct - number of queries: 7785
17 Correct 6 ms 248 KB Output is correct
18 Partially correct 93 ms 304 KB Partially correct - number of queries: 9061
19 Correct 6 ms 376 KB Output is correct
20 Correct 30 ms 248 KB Output is correct
21 Correct 38 ms 252 KB Output is correct
22 Correct 13 ms 248 KB Output is correct
23 Correct 4 ms 420 KB Output is correct
24 Correct 7 ms 376 KB Output is correct
25 Partially correct 43 ms 376 KB Partially correct - number of queries: 5305
26 Partially correct 54 ms 376 KB Partially correct - number of queries: 5241
27 Correct 5 ms 376 KB Output is correct
28 Partially correct 47 ms 376 KB Partially correct - number of queries: 8619
29 Partially correct 69 ms 308 KB Partially correct - number of queries: 6661
30 Partially correct 77 ms 316 KB Partially correct - number of queries: 9004
31 Correct 7 ms 376 KB Output is correct
32 Correct 12 ms 376 KB Output is correct
33 Correct 2 ms 248 KB Output is correct
34 Correct 19 ms 304 KB Output is correct
35 Correct 8 ms 312 KB Output is correct
36 Correct 14 ms 312 KB Output is correct
37 Correct 6 ms 308 KB Output is correct
38 Correct 8 ms 308 KB Output is correct
39 Correct 30 ms 388 KB Output is correct
40 Partially correct 49 ms 376 KB Partially correct - number of queries: 7778
41 Partially correct 30 ms 376 KB Partially correct - number of queries: 5601
42 Partially correct 55 ms 308 KB Partially correct - number of queries: 5601
43 Partially correct 49 ms 292 KB Partially correct - number of queries: 5101
44 Correct 40 ms 304 KB Output is correct
45 Correct 18 ms 388 KB Output is correct
46 Correct 6 ms 376 KB Output is correct
47 Correct 43 ms 376 KB Output is correct
48 Partially correct 72 ms 248 KB Partially correct - number of queries: 6817
49 Correct 13 ms 248 KB Output is correct
50 Partially correct 65 ms 248 KB Partially correct - number of queries: 9058
51 Correct 42 ms 248 KB Output is correct
52 Correct 5 ms 376 KB Output is correct
53 Correct 9 ms 248 KB Output is correct
54 Correct 45 ms 304 KB Output is correct
55 Correct 6 ms 308 KB Output is correct
56 Partially correct 91 ms 248 KB Partially correct - number of queries: 9060
57 Partially correct 64 ms 248 KB Partially correct - number of queries: 6741
58 Partially correct 64 ms 308 KB Partially correct - number of queries: 6847
59 Partially correct 50 ms 248 KB Partially correct - number of queries: 5601
60 Partially correct 45 ms 248 KB Partially correct - number of queries: 5233
61 Correct 5 ms 392 KB Output is correct
62 Correct 6 ms 248 KB Output is correct
63 Correct 8 ms 248 KB Output is correct
64 Correct 6 ms 248 KB Output is correct
65 Correct 6 ms 312 KB Output is correct
66 Correct 11 ms 392 KB Output is correct
67 Correct 7 ms 248 KB Output is correct
68 Correct 6 ms 252 KB Output is correct
69 Correct 14 ms 376 KB Output is correct
70 Correct 6 ms 248 KB Output is correct
71 Partially correct 54 ms 504 KB Partially correct - number of queries: 9206
72 Correct 14 ms 380 KB Output is correct
73 Partially correct 103 ms 248 KB Partially correct - number of queries: 9088
74 Partially correct 83 ms 376 KB Partially correct - number of queries: 9144
75 Correct 8 ms 248 KB Output is correct
76 Partially correct 88 ms 376 KB Partially correct - number of queries: 7928
77 Partially correct 75 ms 312 KB Partially correct - number of queries: 9066
78 Correct 7 ms 376 KB Output is correct
79 Correct 43 ms 248 KB Output is correct
80 Partially correct 95 ms 248 KB Partially correct - number of queries: 9087
81 Partially correct 51 ms 376 KB Partially correct - number of queries: 9114
82 Partially correct 88 ms 248 KB Partially correct - number of queries: 9003
83 Correct 7 ms 248 KB Output is correct
84 Partially correct 66 ms 248 KB Partially correct - number of queries: 7471
85 Partially correct 83 ms 248 KB Partially correct - number of queries: 9052
86 Correct 6 ms 376 KB Output is correct
87 Correct 7 ms 248 KB Output is correct
88 Correct 8 ms 392 KB Output is correct
89 Correct 6 ms 248 KB Output is correct
90 Correct 6 ms 248 KB Output is correct
91 Correct 6 ms 376 KB Output is correct
92 Correct 8 ms 248 KB Output is correct
93 Correct 12 ms 292 KB Output is correct
94 Correct 11 ms 248 KB Output is correct
95 Correct 14 ms 380 KB Output is correct
96 Correct 8 ms 248 KB Output is correct
97 Correct 7 ms 248 KB Output is correct