Submission #64464

# Submission time Handle Problem Language Result Execution time Memory
64464 2018-08-04T15:11:22 Z nvmdava The Big Prize (IOI17_prize) C++17
20 / 100
99 ms 5852 KB
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;


vector<int> ans[210000];
int mx = -1;
int find(int l, int r){
	if(ans[l][0] == ans[r][0]){
		return 0;
	}
	int m = (l + r) >> 1, L = m, R = m + 1;
	while(l < L){
		ans[L] =ask(L);
		if(ans[L][0] + ans[L][1] == mx){
			break;
		}
		if(ans[L][0] + ans[L][1] == 0){
			return L;
		}
		L--;
	}
	while(r > R){
		ans[R] =ask(R);
		if(ans[R][0] + ans[R][1] == mx){
			break;
		}
		if(ans[R][0] + ans[R][1] == 0){
			return R;
		}
		R++;
	}
	return max(find(l, L), find(R, r));
}

int find_best(int n) {
	for(int i = 0; i < 35; 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 l = 0, r = n - 1;
	while(true){
		if(ans[l][0] + ans[l][1] == mx){
			break;
		}
		l++;
	}
	while(true){
		
		ans[r] = ask(r);
		
		if(ans[r][0] + ans[r][1] == mx){
			break;
		}
		if(ans[r][0] + ans[r][1] == 0){
			return r;
		}
		r--;
	}
	return find(l, r);
}

# Verdict Execution time Memory Grader output
1 Correct 9 ms 5156 KB Output is correct
2 Correct 8 ms 5304 KB Output is correct
3 Correct 10 ms 5380 KB Output is correct
4 Correct 9 ms 5380 KB Output is correct
5 Correct 7 ms 5380 KB Output is correct
6 Correct 8 ms 5380 KB Output is correct
7 Correct 10 ms 5380 KB Output is correct
8 Correct 9 ms 5512 KB Output is correct
9 Correct 8 ms 5512 KB Output is correct
10 Correct 9 ms 5512 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 5512 KB Output is correct
2 Correct 9 ms 5512 KB Output is correct
3 Correct 8 ms 5512 KB Output is correct
4 Correct 8 ms 5512 KB Output is correct
5 Correct 8 ms 5512 KB Output is correct
6 Correct 8 ms 5512 KB Output is correct
7 Correct 8 ms 5512 KB Output is correct
8 Correct 8 ms 5512 KB Output is correct
9 Correct 8 ms 5512 KB Output is correct
10 Correct 8 ms 5512 KB Output is correct
11 Correct 21 ms 5564 KB Output is correct
12 Correct 22 ms 5564 KB Output is correct
13 Correct 20 ms 5564 KB Output is correct
14 Correct 28 ms 5564 KB Output is correct
15 Partially correct 49 ms 5708 KB Partially correct - number of queries: 7091
16 Partially correct 79 ms 5708 KB Partially correct - number of queries: 7505
17 Partially correct 62 ms 5708 KB Partially correct - number of queries: 7499
18 Partially correct 94 ms 5708 KB Partially correct - number of queries: 7553
19 Partially correct 60 ms 5732 KB Partially correct - number of queries: 7160
20 Correct 71 ms 5732 KB Output is correct
21 Partially correct 41 ms 5732 KB Partially correct - number of queries: 7481
22 Partially correct 31 ms 5732 KB Partially correct - number of queries: 5818
23 Correct 7 ms 5732 KB Output is correct
24 Correct 12 ms 5732 KB Output is correct
25 Partially correct 58 ms 5732 KB Partially correct - number of queries: 6816
26 Partially correct 86 ms 5732 KB Partially correct - number of queries: 6713
27 Correct 9 ms 5732 KB Output is correct
28 Partially correct 80 ms 5732 KB Partially correct - number of queries: 6778
29 Partially correct 79 ms 5732 KB Partially correct - number of queries: 5722
30 Partially correct 90 ms 5732 KB Partially correct - number of queries: 7509
31 Partially correct 67 ms 5852 KB Partially correct - number of queries: 7431
32 Correct 14 ms 5852 KB Output is correct
33 Correct 8 ms 5852 KB Output is correct
34 Partially correct 44 ms 5852 KB Partially correct - number of queries: 7541
35 Correct 9 ms 5852 KB Output is correct
36 Partially correct 82 ms 5852 KB Partially correct - number of queries: 7586
37 Correct 11 ms 5852 KB Output is correct
38 Correct 10 ms 5852 KB Output is correct
39 Partially correct 41 ms 5852 KB Partially correct - number of queries: 7510
40 Partially correct 37 ms 5852 KB Partially correct - number of queries: 6545
41 Partially correct 68 ms 5852 KB Partially correct - number of queries: 7526
42 Partially correct 59 ms 5852 KB Partially correct - number of queries: 7526
43 Partially correct 79 ms 5852 KB Partially correct - number of queries: 7332
44 Partially correct 99 ms 5852 KB Partially correct - number of queries: 7505
45 Partially correct 82 ms 5852 KB Partially correct - number of queries: 6721
46 Partially correct 78 ms 5852 KB Partially correct - number of queries: 7544
47 Partially correct 50 ms 5852 KB Partially correct - number of queries: 6841
48 Partially correct 76 ms 5852 KB Partially correct - number of queries: 7508
49 Partially correct 89 ms 5852 KB Partially correct - number of queries: 7581
50 Partially correct 73 ms 5852 KB Partially correct - number of queries: 7512
51 Partially correct 74 ms 5852 KB Partially correct - number of queries: 7522
52 Partially correct 97 ms 5852 KB Partially correct - number of queries: 7578
53 Correct 12 ms 5852 KB Output is correct
54 Partially correct 99 ms 5852 KB Partially correct - number of queries: 7496
55 Partially correct 46 ms 5852 KB Partially correct - number of queries: 7554
56 Partially correct 75 ms 5852 KB Partially correct - number of queries: 7598
57 Partially correct 77 ms 5852 KB Partially correct - number of queries: 7537
58 Partially correct 71 ms 5852 KB Partially correct - number of queries: 7540
59 Partially correct 85 ms 5852 KB Partially correct - number of queries: 7568
60 Partially correct 75 ms 5852 KB Partially correct - number of queries: 7517
61 Correct 8 ms 5852 KB Output is correct
62 Correct 11 ms 5852 KB Output is correct
63 Correct 11 ms 5852 KB Output is correct
64 Correct 11 ms 5852 KB Output is correct
65 Correct 9 ms 5852 KB Output is correct
66 Correct 9 ms 5852 KB Output is correct
67 Correct 15 ms 5852 KB Output is correct
68 Incorrect 95 ms 5852 KB Incorrect
69 Halted 0 ms 0 KB -