Submission #931912

# Submission time Handle Problem Language Result Execution time Memory
931912 2024-02-22T14:30:43 Z Lobo The Big Prize (IOI17_prize) C++17
90 / 100
39 ms 1884 KB
#include "prize.h"
#include<bits/stdc++.h>
using namespace std;
#define pb push_back
#define mp make_pair
#define fr first
#define sc second
map<int,pair<int,pair<int,int>>> qr;
 
int cnt = 0;
int cntnonlol;
int n;
pair<int,pair<int,int>> query(int i) {
	if(i == n) return mp(cntnonlol,mp(cntnonlol,0));
	if(qr.count(i)) return qr[i];
	++cnt;
	vector<int> perg = ask(i);
	return qr[i] = mp(perg[0]+perg[1],mp(perg[0],perg[1]));
}
 
int find_best(int N) {
 	n = N;
 	if(n <= 5000) {
 		for(int i = 0; i < n; i++) {
 			if(query(i).fr == 0) return i;
 		}
 	}
 	int S = n/600;
 	stack<pair<int,int>> q;

 	for(int i = 0; i*S < n; i++) {
 		// i*S,(i+1)*S
 		int l = i*S;
 		int r = min(n-1,(i+1)*S);

		q.push(mp(l,r));
 	}

 	while(q.size()) {
 		int l = q.top().fr;
 		int r = q.top().sc;
 		q.pop();
 		if(l > r) continue;

 		if(query(l).fr == 0) return l;
 		if(query(r).fr == 0) return r;
 		if(r-l+1 <= 2) continue;

 		if(query(l) == query(r)) continue;
 		// int mid = (l+r)/2;
 		// q.push(mp(l,mid));
 		// q.push(mp(mid,r));

 		int ml = (2*l+r)/3;
 		int mr = (l+2*r)/3;
 		q.push(mp(l,ml));
 		q.push(mp(ml,mr));
 		q.push(mp(mr,r));
 	}

 	assert(false);
 	return -1;


}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 452 KB Output is correct
2 Correct 1 ms 440 KB Output is correct
3 Correct 2 ms 456 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 1 ms 456 KB Output is correct
6 Correct 3 ms 716 KB Output is correct
7 Correct 2 ms 700 KB Output is correct
8 Correct 2 ms 700 KB Output is correct
9 Correct 1 ms 704 KB Output is correct
10 Correct 4 ms 1220 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 704 KB Output is correct
2 Correct 2 ms 700 KB Output is correct
3 Correct 2 ms 708 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 2 ms 700 KB Output is correct
6 Correct 3 ms 708 KB Output is correct
7 Correct 1 ms 456 KB Output is correct
8 Correct 2 ms 956 KB Output is correct
9 Correct 3 ms 700 KB Output is correct
10 Correct 4 ms 976 KB Output is correct
11 Correct 3 ms 712 KB Output is correct
12 Correct 4 ms 472 KB Output is correct
13 Correct 1 ms 436 KB Output is correct
14 Correct 6 ms 960 KB Output is correct
15 Correct 26 ms 1200 KB Output is correct
16 Correct 6 ms 988 KB Output is correct
17 Partially correct 37 ms 1544 KB Partially correct - number of queries: 6075
18 Correct 0 ms 344 KB Output is correct
19 Partially correct 32 ms 1628 KB Partially correct - number of queries: 5677
20 Correct 11 ms 1080 KB Output is correct
21 Correct 21 ms 1376 KB Output is correct
22 Correct 23 ms 1232 KB Output is correct
23 Correct 3 ms 472 KB Output is correct
24 Correct 6 ms 972 KB Output is correct
25 Correct 13 ms 1036 KB Output is correct
26 Correct 14 ms 1276 KB Output is correct
27 Correct 3 ms 440 KB Output is correct
28 Correct 1 ms 436 KB Output is correct
29 Correct 4 ms 712 KB Output is correct
30 Correct 1 ms 440 KB Output is correct
31 Partially correct 30 ms 1228 KB Partially correct - number of queries: 5981
32 Correct 2 ms 948 KB Output is correct
33 Correct 1 ms 344 KB Output is correct
34 Correct 23 ms 1276 KB Output is correct
35 Correct 2 ms 700 KB Output is correct
36 Correct 25 ms 1076 KB Output is correct
37 Correct 6 ms 712 KB Output is correct
38 Correct 3 ms 716 KB Output is correct
39 Correct 17 ms 1376 KB Output is correct
40 Correct 0 ms 440 KB Output is correct
41 Correct 15 ms 1080 KB Output is correct
42 Correct 14 ms 1244 KB Output is correct
43 Correct 14 ms 1036 KB Output is correct
44 Correct 20 ms 1372 KB Output is correct
45 Correct 22 ms 1596 KB Output is correct
46 Partially correct 28 ms 1652 KB Partially correct - number of queries: 6014
47 Correct 15 ms 1096 KB Output is correct
48 Correct 10 ms 1036 KB Output is correct
49 Partially correct 29 ms 1576 KB Partially correct - number of queries: 5660
50 Correct 1 ms 440 KB Output is correct
51 Correct 20 ms 1284 KB Output is correct
52 Partially correct 30 ms 1624 KB Partially correct - number of queries: 6010
53 Correct 1 ms 616 KB Output is correct
54 Correct 18 ms 1564 KB Output is correct
55 Partially correct 33 ms 1744 KB Partially correct - number of queries: 6072
56 Correct 1 ms 436 KB Output is correct
57 Correct 10 ms 1036 KB Output is correct
58 Correct 13 ms 760 KB Output is correct
59 Correct 13 ms 1548 KB Output is correct
60 Correct 14 ms 1212 KB Output is correct
61 Correct 1 ms 444 KB Output is correct
62 Correct 4 ms 976 KB Output is correct
63 Correct 1 ms 448 KB Output is correct
64 Correct 2 ms 460 KB Output is correct
65 Correct 1 ms 344 KB Output is correct
66 Correct 0 ms 600 KB Output is correct
67 Correct 1 ms 440 KB Output is correct
68 Correct 4 ms 948 KB Output is correct
69 Correct 1 ms 344 KB Output is correct
70 Correct 0 ms 436 KB Output is correct
71 Partially correct 27 ms 1324 KB Partially correct - number of queries: 5793
72 Correct 5 ms 980 KB Output is correct
73 Partially correct 39 ms 1480 KB Partially correct - number of queries: 5716
74 Partially correct 30 ms 1052 KB Partially correct - number of queries: 5749
75 Correct 3 ms 472 KB Output is correct
76 Partially correct 33 ms 1640 KB Partially correct - number of queries: 5001
77 Partially correct 31 ms 1464 KB Partially correct - number of queries: 6159
78 Correct 6 ms 980 KB Output is correct
79 Correct 16 ms 808 KB Output is correct
80 Partially correct 31 ms 1688 KB Partially correct - number of queries: 6167
81 Partially correct 35 ms 1584 KB Partially correct - number of queries: 6221
82 Partially correct 32 ms 1504 KB Partially correct - number of queries: 6165
83 Correct 3 ms 436 KB Output is correct
84 Partially correct 32 ms 1392 KB Partially correct - number of queries: 5189
85 Partially correct 28 ms 1884 KB Partially correct - number of queries: 6169
86 Correct 3 ms 692 KB Output is correct
87 Correct 3 ms 724 KB Output is correct
88 Correct 3 ms 944 KB Output is correct
89 Correct 4 ms 708 KB Output is correct
90 Correct 3 ms 948 KB Output is correct
91 Correct 3 ms 712 KB Output is correct
92 Correct 3 ms 948 KB Output is correct
93 Correct 4 ms 740 KB Output is correct
94 Correct 5 ms 1476 KB Output is correct
95 Correct 4 ms 732 KB Output is correct
96 Correct 4 ms 692 KB Output is correct
97 Correct 1 ms 440 KB Output is correct