Submission #73393

# Submission time Handle Problem Language Result Execution time Memory
73393 2018-08-28T08:13:19 Z hamzqq9 The Big Prize (IOI17_prize) C++14
97.62 / 100
99 ms 2472 KB
#include "prize.h"
#include<bits/stdc++.h>
#define ii pair<int,int>
#define st first
#define nd second
#define pb push_back
using namespace std;

set<int> s;
int bg[200005][2];

int find_best(int n) {
	
	queue<ii> q;

	q.push({0,n-1});

	while(!q.empty()) {

		ii query=q.front();

		q.pop();

		if(query.st>query.nd) continue ;

		vector<int> res;

		int mid=(query.st+query.nd)/2;

		res=ask(mid);

		if(res[0]==0 && res[1]==0) return mid;

		bg[mid][0]=res[0];
		bg[mid][1]=res[1];

		auto rnx=s.lower_bound(mid);
		auto lnx=s.lower_bound(mid);

		if(res[1]) {

			if(rnx==s.end() || bg[mid][1]>bg[*rnx][1] || bg[*rnx][0]>bg[mid][0]) q.push({mid+1,query.nd});

		}

		if(res[0]) {

			if(lnx==s.begin() || bg[mid][1]<bg[*prev(lnx)][1] || bg[*prev(lnx)][0]<bg[mid][0]) q.push({query.st,mid-1});

		}

		s.insert(mid);

	}

	assert(0);

}
# Verdict Execution time Memory Grader output
1 Correct 2 ms 308 KB Output is correct
2 Correct 3 ms 440 KB Output is correct
3 Correct 3 ms 440 KB Output is correct
4 Correct 4 ms 548 KB Output is correct
5 Correct 2 ms 548 KB Output is correct
6 Correct 3 ms 548 KB Output is correct
7 Correct 3 ms 548 KB Output is correct
8 Correct 6 ms 548 KB Output is correct
9 Correct 2 ms 548 KB Output is correct
10 Correct 4 ms 564 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 564 KB Output is correct
2 Correct 3 ms 564 KB Output is correct
3 Correct 2 ms 564 KB Output is correct
4 Correct 4 ms 696 KB Output is correct
5 Correct 4 ms 696 KB Output is correct
6 Correct 2 ms 696 KB Output is correct
7 Correct 2 ms 696 KB Output is correct
8 Correct 2 ms 696 KB Output is correct
9 Correct 2 ms 696 KB Output is correct
10 Correct 3 ms 696 KB Output is correct
11 Correct 8 ms 1084 KB Output is correct
12 Correct 10 ms 1084 KB Output is correct
13 Correct 8 ms 1084 KB Output is correct
14 Correct 11 ms 1084 KB Output is correct
15 Correct 54 ms 2224 KB Output is correct
16 Correct 62 ms 2248 KB Output is correct
17 Partially correct 77 ms 2360 KB Partially correct - number of queries: 5065
18 Correct 20 ms 2360 KB Output is correct
19 Correct 35 ms 2360 KB Output is correct
20 Correct 35 ms 2360 KB Output is correct
21 Correct 34 ms 2360 KB Output is correct
22 Correct 50 ms 2360 KB Output is correct
23 Correct 3 ms 2360 KB Output is correct
24 Correct 7 ms 2360 KB Output is correct
25 Correct 78 ms 2360 KB Output is correct
26 Correct 68 ms 2360 KB Output is correct
27 Correct 5 ms 2360 KB Output is correct
28 Correct 36 ms 2360 KB Output is correct
29 Correct 56 ms 2360 KB Output is correct
30 Correct 53 ms 2360 KB Output is correct
31 Correct 38 ms 2360 KB Output is correct
32 Correct 8 ms 2360 KB Output is correct
33 Correct 3 ms 2360 KB Output is correct
34 Correct 22 ms 2452 KB Output is correct
35 Correct 4 ms 2452 KB Output is correct
36 Correct 87 ms 2452 KB Output is correct
37 Correct 14 ms 2452 KB Output is correct
38 Correct 4 ms 2452 KB Output is correct
39 Correct 70 ms 2452 KB Output is correct
40 Correct 46 ms 2464 KB Output is correct
41 Correct 36 ms 2464 KB Output is correct
42 Correct 25 ms 2464 KB Output is correct
43 Correct 42 ms 2464 KB Output is correct
44 Correct 68 ms 2464 KB Output is correct
45 Correct 56 ms 2464 KB Output is correct
46 Partially correct 99 ms 2464 KB Partially correct - number of queries: 5035
47 Correct 97 ms 2464 KB Output is correct
48 Correct 63 ms 2472 KB Output is correct
49 Correct 58 ms 2472 KB Output is correct
50 Correct 66 ms 2472 KB Output is correct
51 Correct 77 ms 2472 KB Output is correct
52 Partially correct 82 ms 2472 KB Partially correct - number of queries: 5054
53 Correct 4 ms 2472 KB Output is correct
54 Correct 64 ms 2472 KB Output is correct
55 Partially correct 87 ms 2472 KB Partially correct - number of queries: 5054
56 Correct 81 ms 2472 KB Output is correct
57 Correct 28 ms 2472 KB Output is correct
58 Correct 88 ms 2472 KB Output is correct
59 Correct 76 ms 2472 KB Output is correct
60 Correct 38 ms 2472 KB Output is correct
61 Correct 5 ms 2472 KB Output is correct
62 Correct 4 ms 2472 KB Output is correct
63 Correct 5 ms 2472 KB Output is correct
64 Correct 4 ms 2472 KB Output is correct
65 Correct 2 ms 2472 KB Output is correct
66 Correct 3 ms 2472 KB Output is correct
67 Correct 4 ms 2472 KB Output is correct
68 Correct 2 ms 2472 KB Output is correct
69 Correct 3 ms 2472 KB Output is correct
70 Correct 3 ms 2472 KB Output is correct
71 Correct 72 ms 2472 KB Output is correct
72 Correct 9 ms 2472 KB Output is correct
73 Correct 76 ms 2472 KB Output is correct
74 Correct 77 ms 2472 KB Output is correct
75 Correct 4 ms 2472 KB Output is correct
76 Correct 24 ms 2472 KB Output is correct
77 Partially correct 77 ms 2472 KB Partially correct - number of queries: 5191
78 Correct 10 ms 2472 KB Output is correct
79 Correct 27 ms 2472 KB Output is correct
80 Correct 66 ms 2472 KB Output is correct
81 Partially correct 97 ms 2472 KB Partially correct - number of queries: 5013
82 Correct 66 ms 2472 KB Output is correct
83 Correct 4 ms 2472 KB Output is correct
84 Correct 60 ms 2472 KB Output is correct
85 Partially correct 82 ms 2472 KB Partially correct - number of queries: 5238
86 Correct 11 ms 2472 KB Output is correct
87 Correct 6 ms 2472 KB Output is correct
88 Correct 13 ms 2472 KB Output is correct
89 Correct 5 ms 2472 KB Output is correct
90 Correct 3 ms 2472 KB Output is correct
91 Correct 7 ms 2472 KB Output is correct
92 Correct 4 ms 2472 KB Output is correct
93 Correct 9 ms 2472 KB Output is correct
94 Correct 7 ms 2472 KB Output is correct
95 Correct 10 ms 2472 KB Output is correct
96 Correct 8 ms 2472 KB Output is correct
97 Correct 2 ms 2472 KB Output is correct