Submission #931425

# Submission time Handle Problem Language Result Execution time Memory
931425 2024-02-21T18:56:15 Z Lobo The Big Prize (IOI17_prize) C++17
97.5 / 100
34 ms 2040 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;
	// assert(cnt <= 8500);
	vector<int> perg = ask(i);
	return qr[i] = mp(perg[0]+perg[1],mp(perg[0],perg[1]));
}
 
const int B = 477;
const int S = 950;
int find_best(int N) {
 	n = N;
 	queue<pair<int,int>> q;
 	q.push(mp(0,n-1));

 	while(q.size()) {
 		int l = q.front().fr;
 		int r = q.front().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));
 	}

 	assert(false);
 	return -1;


}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
8 Correct 0 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 1 ms 344 KB Output is correct
11 Correct 2 ms 708 KB Output is correct
12 Correct 3 ms 708 KB Output is correct
13 Correct 3 ms 952 KB Output is correct
14 Correct 5 ms 688 KB Output is correct
15 Correct 22 ms 2040 KB Output is correct
16 Correct 21 ms 1348 KB Output is correct
17 Correct 19 ms 1532 KB Output is correct
18 Correct 24 ms 1120 KB Output is correct
19 Correct 11 ms 1800 KB Output is correct
20 Correct 13 ms 1228 KB Output is correct
21 Correct 15 ms 1328 KB Output is correct
22 Correct 17 ms 1272 KB Output is correct
23 Correct 1 ms 440 KB Output is correct
24 Correct 2 ms 964 KB Output is correct
25 Correct 19 ms 864 KB Output is correct
26 Correct 23 ms 1368 KB Output is correct
27 Correct 1 ms 440 KB Output is correct
28 Correct 11 ms 1300 KB Output is correct
29 Correct 20 ms 968 KB Output is correct
30 Correct 22 ms 1136 KB Output is correct
31 Correct 19 ms 1604 KB Output is correct
32 Correct 2 ms 708 KB Output is correct
33 Correct 0 ms 344 KB Output is correct
34 Correct 11 ms 1016 KB Output is correct
35 Correct 1 ms 440 KB Output is correct
36 Correct 28 ms 1428 KB Output is correct
37 Correct 2 ms 868 KB Output is correct
38 Correct 1 ms 432 KB Output is correct
39 Correct 28 ms 804 KB Output is correct
40 Correct 15 ms 1824 KB Output is correct
41 Correct 22 ms 812 KB Output is correct
42 Correct 20 ms 1364 KB Output is correct
43 Correct 15 ms 1512 KB Output is correct
44 Correct 20 ms 1272 KB Output is correct
45 Correct 22 ms 1352 KB Output is correct
46 Correct 17 ms 1528 KB Output is correct
47 Correct 26 ms 1264 KB Output is correct
48 Correct 21 ms 716 KB Output is correct
49 Correct 11 ms 1076 KB Output is correct
50 Partially correct 30 ms 1408 KB Partially correct - number of queries: 5070
51 Correct 23 ms 836 KB Output is correct
52 Correct 24 ms 1060 KB Output is correct
53 Correct 1 ms 436 KB Output is correct
54 Correct 17 ms 1572 KB Output is correct
55 Correct 21 ms 1316 KB Output is correct
56 Correct 9 ms 980 KB Output is correct
57 Correct 17 ms 1516 KB Output is correct
58 Correct 27 ms 1044 KB Output is correct
59 Correct 25 ms 1688 KB Output is correct
60 Correct 22 ms 1248 KB Output is correct
61 Correct 1 ms 436 KB Output is correct
62 Correct 1 ms 436 KB Output is correct
63 Correct 1 ms 440 KB Output is correct
64 Correct 1 ms 444 KB Output is correct
65 Correct 0 ms 432 KB Output is correct
66 Correct 0 ms 436 KB Output is correct
67 Correct 1 ms 344 KB Output is correct
68 Correct 0 ms 344 KB Output is correct
69 Correct 1 ms 600 KB Output is correct
70 Correct 1 ms 344 KB Output is correct
71 Correct 29 ms 1128 KB Output is correct
72 Correct 2 ms 876 KB Output is correct
73 Correct 24 ms 1624 KB Output is correct
74 Correct 20 ms 1176 KB Output is correct
75 Correct 1 ms 432 KB Output is correct
76 Correct 22 ms 1384 KB Output is correct
77 Partially correct 30 ms 968 KB Partially correct - number of queries: 5250
78 Correct 2 ms 688 KB Output is correct
79 Correct 11 ms 952 KB Output is correct
80 Partially correct 34 ms 796 KB Partially correct - number of queries: 5015
81 Partially correct 25 ms 1240 KB Partially correct - number of queries: 5214
82 Partially correct 25 ms 1556 KB Partially correct - number of queries: 5122
83 Correct 1 ms 432 KB Output is correct
84 Correct 21 ms 1996 KB Output is correct
85 Partially correct 25 ms 1536 KB Partially correct - number of queries: 5249
86 Correct 4 ms 944 KB Output is correct
87 Correct 2 ms 952 KB Output is correct
88 Correct 4 ms 948 KB Output is correct
89 Correct 4 ms 696 KB Output is correct
90 Correct 1 ms 432 KB Output is correct
91 Correct 2 ms 440 KB Output is correct
92 Correct 0 ms 436 KB Output is correct
93 Correct 2 ms 688 KB Output is correct
94 Correct 2 ms 688 KB Output is correct
95 Correct 2 ms 708 KB Output is correct
96 Correct 2 ms 452 KB Output is correct
97 Correct 0 ms 344 KB Output is correct