Submission #64593

# Submission time Handle Problem Language Result Execution time Memory
64593 2018-08-05T02:38:18 Z nvmdava The Big Prize (IOI17_prize) C++17
20 / 100
131 ms 5820 KB
#include "prize.h"
#include <bits/stdc++.h>
using namespace std;
 
 
vector<int> ans[210000];
int mx = -1, ll, rr, Q = -1;
int find(int l, int r){
	if(Q != -1){
		return 0;
	}
	if(ans[l][0] == ans[r][0]){
		return 0;
	}
	if(ll > r || rr < l){
		return 0;
	}
	int m = (l + r) >> 1, L = m, R = m + 1;
	while(l < L){
		if(L < ll){
			break;
		}
		ans[L] =ask(L);
		if(ans[L][0] + ans[L][1] == mx){
			break;
		}
		if(ans[L][0] + ans[L][1] == 0){
			Q = L;
			return L;
		}
		if(ans[L][0] == 0){
			ll = L + 1;
			break;
		}
		L--;
	}
	while(r > R){
		if(R > rr){
			break;
		}
		ans[R] =ask(R);
		if(ans[R][0] + ans[R][1] == mx){
			break;
		}
		if(ans[R][0] + ans[R][1] == 0){
			Q = R;
			return R;
		}
		if(ans[R][1] == 0){
			rr = R - 1;
			break;	
		}
		R++;
	}
	return max(find(l, L), find(R, r));
}
 
int find_best(int n) {
	ll = 0;
	rr = n - 1;
	for(int i = 0; i < 448; 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 11 ms 5240 KB Output is correct
2 Correct 11 ms 5428 KB Output is correct
3 Correct 10 ms 5428 KB Output is correct
4 Correct 12 ms 5428 KB Output is correct
5 Correct 10 ms 5428 KB Output is correct
6 Correct 7 ms 5428 KB Output is correct
7 Correct 9 ms 5572 KB Output is correct
8 Correct 8 ms 5572 KB Output is correct
9 Correct 15 ms 5572 KB Output is correct
10 Correct 11 ms 5572 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 15 ms 5572 KB Output is correct
2 Correct 13 ms 5572 KB Output is correct
3 Correct 16 ms 5572 KB Output is correct
4 Correct 11 ms 5572 KB Output is correct
5 Correct 12 ms 5572 KB Output is correct
6 Correct 8 ms 5572 KB Output is correct
7 Correct 13 ms 5572 KB Output is correct
8 Correct 8 ms 5572 KB Output is correct
9 Correct 10 ms 5572 KB Output is correct
10 Correct 11 ms 5572 KB Output is correct
11 Correct 15 ms 5572 KB Output is correct
12 Correct 24 ms 5572 KB Output is correct
13 Correct 12 ms 5572 KB Output is correct
14 Correct 22 ms 5572 KB Output is correct
15 Partially correct 64 ms 5572 KB Partially correct - number of queries: 6312
16 Correct 31 ms 5572 KB Output is correct
17 Correct 15 ms 5572 KB Output is correct
18 Correct 16 ms 5572 KB Output is correct
19 Partially correct 102 ms 5688 KB Partially correct - number of queries: 7570
20 Correct 50 ms 5688 KB Output is correct
21 Partially correct 48 ms 5688 KB Partially correct - number of queries: 5196
22 Partially correct 89 ms 5688 KB Partially correct - number of queries: 5661
23 Correct 16 ms 5688 KB Output is correct
24 Correct 16 ms 5688 KB Output is correct
25 Correct 36 ms 5688 KB Output is correct
26 Correct 33 ms 5688 KB Output is correct
27 Correct 18 ms 5688 KB Output is correct
28 Correct 19 ms 5688 KB Output is correct
29 Correct 25 ms 5688 KB Output is correct
30 Correct 11 ms 5688 KB Output is correct
31 Correct 15 ms 5688 KB Output is correct
32 Correct 9 ms 5688 KB Output is correct
33 Correct 8 ms 5688 KB Output is correct
34 Partially correct 71 ms 5688 KB Partially correct - number of queries: 5670
35 Correct 14 ms 5688 KB Output is correct
36 Partially correct 100 ms 5820 KB Partially correct - number of queries: 6356
37 Correct 20 ms 5820 KB Output is correct
38 Correct 13 ms 5820 KB Output is correct
39 Correct 52 ms 5820 KB Output is correct
40 Correct 14 ms 5820 KB Output is correct
41 Correct 22 ms 5820 KB Output is correct
42 Correct 39 ms 5820 KB Output is correct
43 Correct 30 ms 5820 KB Output is correct
44 Partially correct 74 ms 5820 KB Partially correct - number of queries: 5025
45 Partially correct 74 ms 5820 KB Partially correct - number of queries: 5060
46 Correct 10 ms 5820 KB Output is correct
47 Correct 78 ms 5820 KB Output is correct
48 Correct 38 ms 5820 KB Output is correct
49 Partially correct 112 ms 5820 KB Partially correct - number of queries: 7431
50 Correct 11 ms 5820 KB Output is correct
51 Partially correct 67 ms 5820 KB Partially correct - number of queries: 5042
52 Partially correct 65 ms 5820 KB Partially correct - number of queries: 7944
53 Correct 16 ms 5820 KB Output is correct
54 Correct 71 ms 5820 KB Output is correct
55 Correct 12 ms 5820 KB Output is correct
56 Correct 14 ms 5820 KB Output is correct
57 Correct 41 ms 5820 KB Output is correct
58 Correct 16 ms 5820 KB Output is correct
59 Correct 52 ms 5820 KB Output is correct
60 Correct 53 ms 5820 KB Output is correct
61 Correct 9 ms 5820 KB Output is correct
62 Correct 14 ms 5820 KB Output is correct
63 Correct 13 ms 5820 KB Output is correct
64 Correct 13 ms 5820 KB Output is correct
65 Correct 16 ms 5820 KB Output is correct
66 Correct 13 ms 5820 KB Output is correct
67 Correct 19 ms 5820 KB Output is correct
68 Correct 14 ms 5820 KB Output is correct
69 Correct 14 ms 5820 KB Output is correct
70 Correct 14 ms 5820 KB Output is correct
71 Partially correct 131 ms 5820 KB Partially correct - number of queries: 8551
72 Correct 17 ms 5820 KB Output is correct
73 Partially correct 78 ms 5820 KB Partially correct - number of queries: 8446
74 Partially correct 88 ms 5820 KB Partially correct - number of queries: 8491
75 Correct 16 ms 5820 KB Output is correct
76 Partially correct 81 ms 5820 KB Partially correct - number of queries: 7471
77 Partially correct 84 ms 5820 KB Partially correct - number of queries: 7678
78 Correct 17 ms 5820 KB Output is correct
79 Correct 43 ms 5820 KB Output is correct
80 Partially correct 39 ms 5820 KB Partially correct - number of queries: 7696
81 Partially correct 71 ms 5820 KB Partially correct - number of queries: 7673
82 Partially correct 76 ms 5820 KB Partially correct - number of queries: 7719
83 Correct 12 ms 5820 KB Output is correct
84 Partially correct 85 ms 5820 KB Partially correct - number of queries: 6491
85 Partially correct 74 ms 5820 KB Partially correct - number of queries: 7709
86 Incorrect 93 ms 5820 KB Incorrect
87 Halted 0 ms 0 KB -