#include <bits/stdc++.h>
#include "prize.h"
using namespace std;
int find_best(int n) {
int N=2e5+5;
int lo=(int)sqrt(N);
int maxx=0;
for(int i=0;i<lo;i++)
{
vector<int> tr=ask(i);
int t=tr[0]+tr[1];
if(t==0)
return i;
maxx=max(maxx,t);
}
int nasao=0;
int last=n-1;
while(true)
{
int l=0,r=last;
while(l<r)
{
int m=(l+r+1)>>1;
vector<int> tr=ask(m);
int t=tr[0]+tr[1];
if(t==0)
return m;
if(t!=maxx)
{
l=m;
continue;
}
if(tr[1]>nasao)
l=m+1;
else
r=m-1;
}
vector<int> tr=ask(l);
int t=tr[0]+tr[1];
if(t==0)
return l;
last=l-1;
nasao++;
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
7 ms |
248 KB |
Output is correct |
2 |
Correct |
6 ms |
328 KB |
Output is correct |
3 |
Correct |
4 ms |
512 KB |
Output is correct |
4 |
Correct |
4 ms |
564 KB |
Output is correct |
5 |
Correct |
7 ms |
564 KB |
Output is correct |
6 |
Correct |
2 ms |
564 KB |
Output is correct |
7 |
Correct |
6 ms |
564 KB |
Output is correct |
8 |
Correct |
5 ms |
564 KB |
Output is correct |
9 |
Correct |
4 ms |
564 KB |
Output is correct |
10 |
Correct |
6 ms |
564 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
572 KB |
Output is correct |
2 |
Correct |
7 ms |
572 KB |
Output is correct |
3 |
Correct |
4 ms |
572 KB |
Output is correct |
4 |
Correct |
8 ms |
572 KB |
Output is correct |
5 |
Correct |
7 ms |
572 KB |
Output is correct |
6 |
Correct |
2 ms |
572 KB |
Output is correct |
7 |
Correct |
6 ms |
572 KB |
Output is correct |
8 |
Correct |
5 ms |
572 KB |
Output is correct |
9 |
Correct |
4 ms |
572 KB |
Output is correct |
10 |
Correct |
8 ms |
572 KB |
Output is correct |
11 |
Correct |
9 ms |
572 KB |
Output is correct |
12 |
Correct |
11 ms |
572 KB |
Output is correct |
13 |
Correct |
4 ms |
572 KB |
Output is correct |
14 |
Correct |
37 ms |
572 KB |
Output is correct |
15 |
Partially correct |
51 ms |
572 KB |
Partially correct - number of queries: 5947 |
16 |
Correct |
10 ms |
572 KB |
Output is correct |
17 |
Correct |
6 ms |
572 KB |
Output is correct |
18 |
Correct |
4 ms |
572 KB |
Output is correct |
19 |
Partially correct |
75 ms |
572 KB |
Partially correct - number of queries: 7786 |
20 |
Correct |
19 ms |
572 KB |
Output is correct |
21 |
Partially correct |
25 ms |
572 KB |
Partially correct - number of queries: 5621 |
22 |
Partially correct |
32 ms |
572 KB |
Partially correct - number of queries: 5794 |
23 |
Correct |
7 ms |
572 KB |
Output is correct |
24 |
Correct |
11 ms |
572 KB |
Output is correct |
25 |
Correct |
49 ms |
572 KB |
Output is correct |
26 |
Correct |
42 ms |
572 KB |
Output is correct |
27 |
Correct |
6 ms |
572 KB |
Output is correct |
28 |
Correct |
6 ms |
572 KB |
Output is correct |
29 |
Correct |
15 ms |
572 KB |
Output is correct |
30 |
Correct |
4 ms |
572 KB |
Output is correct |
31 |
Correct |
6 ms |
572 KB |
Output is correct |
32 |
Correct |
9 ms |
572 KB |
Output is correct |
33 |
Correct |
2 ms |
572 KB |
Output is correct |
34 |
Partially correct |
56 ms |
572 KB |
Partially correct - number of queries: 6163 |
35 |
Correct |
6 ms |
572 KB |
Output is correct |
36 |
Partially correct |
68 ms |
572 KB |
Partially correct - number of queries: 6725 |
37 |
Correct |
12 ms |
572 KB |
Output is correct |
38 |
Correct |
5 ms |
572 KB |
Output is correct |
39 |
Partially correct |
48 ms |
572 KB |
Partially correct - number of queries: 5039 |
40 |
Correct |
7 ms |
572 KB |
Output is correct |
41 |
Correct |
18 ms |
572 KB |
Output is correct |
42 |
Correct |
44 ms |
572 KB |
Output is correct |
43 |
Correct |
58 ms |
572 KB |
Output is correct |
44 |
Partially correct |
65 ms |
572 KB |
Partially correct - number of queries: 5512 |
45 |
Partially correct |
28 ms |
572 KB |
Partially correct - number of queries: 6076 |
46 |
Correct |
4 ms |
572 KB |
Output is correct |
47 |
Correct |
29 ms |
572 KB |
Output is correct |
48 |
Correct |
28 ms |
572 KB |
Output is correct |
49 |
Partially correct |
70 ms |
572 KB |
Partially correct - number of queries: 7852 |
50 |
Correct |
6 ms |
572 KB |
Output is correct |
51 |
Partially correct |
25 ms |
572 KB |
Partially correct - number of queries: 5474 |
52 |
Partially correct |
44 ms |
576 KB |
Partially correct - number of queries: 8223 |
53 |
Correct |
4 ms |
576 KB |
Output is correct |
54 |
Partially correct |
40 ms |
576 KB |
Partially correct - number of queries: 5275 |
55 |
Correct |
6 ms |
576 KB |
Output is correct |
56 |
Correct |
6 ms |
576 KB |
Output is correct |
57 |
Correct |
14 ms |
576 KB |
Output is correct |
58 |
Correct |
14 ms |
576 KB |
Output is correct |
59 |
Correct |
44 ms |
576 KB |
Output is correct |
60 |
Correct |
19 ms |
576 KB |
Output is correct |
61 |
Correct |
6 ms |
576 KB |
Output is correct |
62 |
Correct |
4 ms |
576 KB |
Output is correct |
63 |
Correct |
7 ms |
576 KB |
Output is correct |
64 |
Correct |
4 ms |
576 KB |
Output is correct |
65 |
Correct |
6 ms |
576 KB |
Output is correct |
66 |
Correct |
5 ms |
576 KB |
Output is correct |
67 |
Correct |
25 ms |
576 KB |
Output is correct |
68 |
Correct |
6 ms |
576 KB |
Output is correct |
69 |
Correct |
4 ms |
576 KB |
Output is correct |
70 |
Correct |
19 ms |
576 KB |
Output is correct |
71 |
Partially correct |
87 ms |
576 KB |
Partially correct - number of queries: 8307 |
72 |
Correct |
6 ms |
576 KB |
Output is correct |
73 |
Partially correct |
66 ms |
576 KB |
Partially correct - number of queries: 8193 |
74 |
Partially correct |
98 ms |
576 KB |
Partially correct - number of queries: 8241 |
75 |
Correct |
8 ms |
576 KB |
Output is correct |
76 |
Partially correct |
68 ms |
576 KB |
Partially correct - number of queries: 7102 |
77 |
Partially correct |
86 ms |
576 KB |
Partially correct - number of queries: 8360 |
78 |
Correct |
12 ms |
576 KB |
Output is correct |
79 |
Correct |
20 ms |
576 KB |
Output is correct |
80 |
Partially correct |
73 ms |
576 KB |
Partially correct - number of queries: 8363 |
81 |
Partially correct |
73 ms |
576 KB |
Partially correct - number of queries: 8347 |
82 |
Partially correct |
76 ms |
576 KB |
Partially correct - number of queries: 8255 |
83 |
Correct |
7 ms |
576 KB |
Output is correct |
84 |
Partially correct |
61 ms |
576 KB |
Partially correct - number of queries: 6855 |
85 |
Partially correct |
83 ms |
576 KB |
Partially correct - number of queries: 8309 |
86 |
Incorrect |
43 ms |
576 KB |
Incorrect |
87 |
Halted |
0 ms |
0 KB |
- |