Submission #427537

# Submission time Handle Problem Language Result Execution time Memory
427537 2021-06-14T16:46:15 Z Hazem The Big Prize (IOI17_prize) C++14
90 / 100
147 ms 1212 KB
#include "prize.h"
#include <bits/stdc++.h>
 
using namespace std;

map<int,vector<int>>mp;

int find_best(int n) {
 
	vector<int>cur = ask(0);
	int idx = 0;
	if(!cur[0]&&!cur[1])
		return 0;
 
	while(1){
		
		int l = idx,r = min(n-1,idx+900);
		while(l<r){
			
			int mid = (l+r+1)/2;
			
			vector<int>vec;
			if(mp.find(mid)!=mp.end())
				vec = mp[mid];
			else 
				vec = ask(mid);

			mp[mid] = vec;
			if(vec==cur)l = mid;
			else r = mid-1;
		}
		cur = ask(l+1);
		idx = l+1;
		assert(idx<n);
		if(!cur[0]&&!cur[1])
			return idx;
	}
}
# Verdict Execution time Memory Grader output
1 Correct 4 ms 272 KB Output is correct
2 Correct 12 ms 388 KB Output is correct
3 Correct 17 ms 324 KB Output is correct
4 Correct 17 ms 500 KB Output is correct
5 Correct 13 ms 320 KB Output is correct
6 Correct 1 ms 200 KB Output is correct
7 Correct 13 ms 272 KB Output is correct
8 Correct 17 ms 308 KB Output is correct
9 Correct 6 ms 444 KB Output is correct
10 Correct 36 ms 416 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 436 KB Output is correct
2 Correct 13 ms 320 KB Output is correct
3 Correct 18 ms 412 KB Output is correct
4 Correct 35 ms 448 KB Output is correct
5 Correct 19 ms 356 KB Output is correct
6 Correct 1 ms 284 KB Output is correct
7 Correct 14 ms 320 KB Output is correct
8 Correct 14 ms 300 KB Output is correct
9 Correct 9 ms 384 KB Output is correct
10 Correct 35 ms 456 KB Output is correct
11 Correct 14 ms 320 KB Output is correct
12 Correct 2 ms 284 KB Output is correct
13 Correct 32 ms 456 KB Output is correct
14 Correct 7 ms 328 KB Output is correct
15 Correct 18 ms 284 KB Output is correct
16 Partially correct 98 ms 936 KB Partially correct - number of queries: 7661
17 Correct 1 ms 276 KB Output is correct
18 Partially correct 109 ms 1120 KB Partially correct - number of queries: 9286
19 Correct 1 ms 260 KB Output is correct
20 Correct 41 ms 460 KB Output is correct
21 Correct 47 ms 552 KB Output is correct
22 Correct 4 ms 332 KB Output is correct
23 Correct 3 ms 272 KB Output is correct
24 Correct 1 ms 284 KB Output is correct
25 Partially correct 53 ms 712 KB Partially correct - number of queries: 5294
26 Partially correct 61 ms 664 KB Partially correct - number of queries: 5239
27 Correct 10 ms 404 KB Output is correct
28 Partially correct 79 ms 1212 KB Partially correct - number of queries: 9443
29 Partially correct 101 ms 960 KB Partially correct - number of queries: 7198
30 Partially correct 49 ms 1152 KB Partially correct - number of queries: 9091
31 Correct 1 ms 224 KB Output is correct
32 Correct 27 ms 344 KB Output is correct
33 Correct 1 ms 200 KB Output is correct
34 Correct 45 ms 572 KB Output is correct
35 Correct 18 ms 320 KB Output is correct
36 Correct 31 ms 400 KB Output is correct
37 Correct 4 ms 380 KB Output is correct
38 Correct 3 ms 200 KB Output is correct
39 Correct 58 ms 536 KB Output is correct
40 Partially correct 72 ms 1096 KB Partially correct - number of queries: 8217
41 Partially correct 27 ms 744 KB Partially correct - number of queries: 5103
42 Partially correct 27 ms 748 KB Partially correct - number of queries: 5103
43 Correct 70 ms 660 KB Output is correct
44 Correct 20 ms 724 KB Output is correct
45 Correct 24 ms 576 KB Output is correct
46 Correct 1 ms 276 KB Output is correct
47 Correct 69 ms 708 KB Output is correct
48 Partially correct 89 ms 940 KB Partially correct - number of queries: 6587
49 Correct 10 ms 276 KB Output is correct
50 Partially correct 77 ms 1196 KB Partially correct - number of queries: 9265
51 Correct 20 ms 616 KB Output is correct
52 Correct 2 ms 276 KB Output is correct
53 Correct 12 ms 540 KB Output is correct
54 Correct 20 ms 676 KB Output is correct
55 Correct 1 ms 268 KB Output is correct
56 Partially correct 85 ms 1152 KB Partially correct - number of queries: 9278
57 Partially correct 94 ms 832 KB Partially correct - number of queries: 6597
58 Partially correct 46 ms 1064 KB Partially correct - number of queries: 6730
59 Partially correct 54 ms 720 KB Partially correct - number of queries: 5103
60 Partially correct 44 ms 752 KB Partially correct - number of queries: 5136
61 Correct 33 ms 448 KB Output is correct
62 Correct 4 ms 200 KB Output is correct
63 Correct 12 ms 492 KB Output is correct
64 Correct 15 ms 320 KB Output is correct
65 Correct 35 ms 584 KB Output is correct
66 Correct 20 ms 444 KB Output is correct
67 Correct 25 ms 432 KB Output is correct
68 Correct 1 ms 200 KB Output is correct
69 Correct 16 ms 480 KB Output is correct
70 Correct 14 ms 484 KB Output is correct
71 Partially correct 96 ms 1200 KB Partially correct - number of queries: 9429
72 Correct 44 ms 460 KB Output is correct
73 Partially correct 107 ms 1080 KB Partially correct - number of queries: 9289
74 Partially correct 117 ms 1104 KB Partially correct - number of queries: 9349
75 Correct 31 ms 468 KB Output is correct
76 Partially correct 72 ms 1072 KB Partially correct - number of queries: 8255
77 Partially correct 112 ms 1184 KB Partially correct - number of queries: 9461
78 Correct 37 ms 448 KB Output is correct
79 Partially correct 30 ms 752 KB Partially correct - number of queries: 5561
80 Partially correct 67 ms 1108 KB Partially correct - number of queries: 9472
81 Partially correct 115 ms 1096 KB Partially correct - number of queries: 9480
82 Partially correct 147 ms 1132 KB Partially correct - number of queries: 9401
83 Correct 42 ms 464 KB Output is correct
84 Partially correct 45 ms 980 KB Partially correct - number of queries: 8136
85 Partially correct 84 ms 1160 KB Partially correct - number of queries: 9519
86 Correct 59 ms 452 KB Output is correct
87 Correct 31 ms 456 KB Output is correct
88 Correct 33 ms 448 KB Output is correct
89 Correct 36 ms 464 KB Output is correct
90 Correct 29 ms 500 KB Output is correct
91 Correct 33 ms 460 KB Output is correct
92 Correct 35 ms 452 KB Output is correct
93 Correct 38 ms 468 KB Output is correct
94 Correct 32 ms 448 KB Output is correct
95 Correct 42 ms 448 KB Output is correct
96 Correct 28 ms 428 KB Output is correct
97 Correct 14 ms 520 KB Output is correct