Submission #64603

# Submission time Handle Problem Language Result Execution time Memory
64603 2018-08-05T03:09:57 Z nvmdava The Big Prize (IOI17_prize) C++14
90 / 100
144 ms 5896 KB
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;
 
 
vector<int> ans[210000];
int mx = -1;

int find_best(int n) {
	
	for(int i = 0; i < 500; i++){
		ans[i] = ask(i);
		if(ans[i][0] + ans[i][1] == 0){
			return i;
		}
		mx = max(mx, ans[i][0] + ans[i][1]);
	}
	int id = 0;
	while(id < n){	
		ans[id] = ask(id);
		if(ans[id][0] + ans[id][1] == 0) return id;
		while(ans[id][0] + ans[id][1] != mx && id < n){
			id++;
			ans[id]  = ask(id);
			if(ans[id][0] + ans[id][1] == 0) return id;
		}
		int l = id, r = n - 1;
		int k = 0;
		while(l <= r)
		{
			int m = (l + r) >> 1;
			ans[m] = ask(m);
			if(ans[m][1] != ans[id][1] || ans[m][0] + ans[m][1] < mx) r = m - 1;
			else {
				l = m + 1;
				k = m;
			}
		}
		id = k + 1;
	}
}

Compilation message

prize.cpp: In function 'int find_best(int)':
prize.cpp:41:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
# Verdict Execution time Memory Grader output
1 Correct 17 ms 5368 KB Output is correct
2 Correct 19 ms 5368 KB Output is correct
3 Correct 10 ms 5396 KB Output is correct
4 Correct 15 ms 5396 KB Output is correct
5 Correct 11 ms 5444 KB Output is correct
6 Correct 8 ms 5444 KB Output is correct
7 Correct 19 ms 5444 KB Output is correct
8 Correct 17 ms 5444 KB Output is correct
9 Correct 17 ms 5540 KB Output is correct
10 Correct 13 ms 5540 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 15 ms 5540 KB Output is correct
2 Correct 17 ms 5540 KB Output is correct
3 Correct 12 ms 5540 KB Output is correct
4 Correct 14 ms 5540 KB Output is correct
5 Correct 18 ms 5540 KB Output is correct
6 Correct 8 ms 5540 KB Output is correct
7 Correct 16 ms 5540 KB Output is correct
8 Correct 14 ms 5540 KB Output is correct
9 Correct 22 ms 5540 KB Output is correct
10 Correct 17 ms 5564 KB Output is correct
11 Correct 23 ms 5564 KB Output is correct
12 Correct 19 ms 5564 KB Output is correct
13 Correct 23 ms 5564 KB Output is correct
14 Correct 25 ms 5564 KB Output is correct
15 Correct 32 ms 5564 KB Output is correct
16 Partially correct 114 ms 5776 KB Partially correct - number of queries: 7831
17 Correct 14 ms 5776 KB Output is correct
18 Partially correct 68 ms 5776 KB Partially correct - number of queries: 9113
19 Correct 10 ms 5776 KB Output is correct
20 Correct 51 ms 5776 KB Output is correct
21 Correct 54 ms 5776 KB Output is correct
22 Correct 29 ms 5776 KB Output is correct
23 Correct 15 ms 5776 KB Output is correct
24 Correct 17 ms 5776 KB Output is correct
25 Partially correct 73 ms 5776 KB Partially correct - number of queries: 5367
26 Partially correct 65 ms 5776 KB Partially correct - number of queries: 5290
27 Correct 17 ms 5776 KB Output is correct
28 Partially correct 140 ms 5796 KB Partially correct - number of queries: 8682
29 Partially correct 114 ms 5796 KB Partially correct - number of queries: 6695
30 Partially correct 126 ms 5796 KB Partially correct - number of queries: 9036
31 Correct 9 ms 5796 KB Output is correct
32 Correct 25 ms 5796 KB Output is correct
33 Correct 8 ms 5796 KB Output is correct
34 Correct 60 ms 5796 KB Output is correct
35 Correct 15 ms 5796 KB Output is correct
36 Correct 48 ms 5796 KB Output is correct
37 Correct 21 ms 5796 KB Output is correct
38 Correct 18 ms 5796 KB Output is correct
39 Correct 60 ms 5796 KB Output is correct
40 Partially correct 102 ms 5796 KB Partially correct - number of queries: 7791
41 Partially correct 85 ms 5796 KB Partially correct - number of queries: 5647
42 Partially correct 66 ms 5796 KB Partially correct - number of queries: 5647
43 Partially correct 77 ms 5796 KB Partially correct - number of queries: 5147
44 Correct 56 ms 5796 KB Output is correct
45 Correct 32 ms 5796 KB Output is correct
46 Correct 13 ms 5796 KB Output is correct
47 Correct 35 ms 5796 KB Output is correct
48 Partially correct 94 ms 5796 KB Partially correct - number of queries: 6861
49 Correct 26 ms 5796 KB Output is correct
50 Partially correct 120 ms 5796 KB Partially correct - number of queries: 9107
51 Correct 58 ms 5796 KB Output is correct
52 Correct 17 ms 5796 KB Output is correct
53 Correct 16 ms 5796 KB Output is correct
54 Correct 64 ms 5796 KB Output is correct
55 Correct 16 ms 5796 KB Output is correct
56 Partially correct 130 ms 5796 KB Partially correct - number of queries: 9106
57 Partially correct 108 ms 5796 KB Partially correct - number of queries: 6774
58 Partially correct 99 ms 5796 KB Partially correct - number of queries: 6880
59 Partially correct 100 ms 5796 KB Partially correct - number of queries: 5647
60 Partially correct 83 ms 5796 KB Partially correct - number of queries: 5273
61 Correct 14 ms 5796 KB Output is correct
62 Correct 17 ms 5796 KB Output is correct
63 Correct 20 ms 5796 KB Output is correct
64 Correct 20 ms 5796 KB Output is correct
65 Correct 14 ms 5796 KB Output is correct
66 Correct 17 ms 5796 KB Output is correct
67 Correct 17 ms 5796 KB Output is correct
68 Correct 17 ms 5796 KB Output is correct
69 Correct 20 ms 5796 KB Output is correct
70 Correct 18 ms 5796 KB Output is correct
71 Partially correct 132 ms 5796 KB Partially correct - number of queries: 9245
72 Correct 25 ms 5796 KB Output is correct
73 Partially correct 132 ms 5796 KB Partially correct - number of queries: 9114
74 Partially correct 131 ms 5796 KB Partially correct - number of queries: 9192
75 Correct 19 ms 5796 KB Output is correct
76 Partially correct 97 ms 5796 KB Partially correct - number of queries: 7941
77 Partially correct 56 ms 5796 KB Partially correct - number of queries: 7612
78 Correct 24 ms 5796 KB Output is correct
79 Correct 76 ms 5796 KB Output is correct
80 Partially correct 97 ms 5796 KB Partially correct - number of queries: 9124
81 Partially correct 144 ms 5828 KB Partially correct - number of queries: 9092
82 Partially correct 105 ms 5828 KB Partially correct - number of queries: 9060
83 Correct 18 ms 5828 KB Output is correct
84 Partially correct 108 ms 5828 KB Partially correct - number of queries: 7553
85 Partially correct 144 ms 5896 KB Partially correct - number of queries: 9150
86 Correct 19 ms 5896 KB Output is correct
87 Correct 17 ms 5896 KB Output is correct
88 Correct 23 ms 5896 KB Output is correct
89 Correct 25 ms 5896 KB Output is correct
90 Correct 18 ms 5896 KB Output is correct
91 Correct 26 ms 5896 KB Output is correct
92 Correct 21 ms 5896 KB Output is correct
93 Correct 31 ms 5896 KB Output is correct
94 Correct 26 ms 5896 KB Output is correct
95 Correct 38 ms 5896 KB Output is correct
96 Correct 27 ms 5896 KB Output is correct
97 Correct 19 ms 5896 KB Output is correct