#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=0;
while(true)
{
int l=last,r=n-1;
while(l<r)
{
int m=(l+r)>>1;
vector<int> tr=ask(m);
int t=tr[0]+tr[1];
if(t!=maxx)
{
r=m;
continue;
}
if(tr[0]>nasao)
r=m-1;
else
l=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 |
304 KB |
Output is correct |
2 |
Correct |
5 ms |
324 KB |
Output is correct |
3 |
Correct |
6 ms |
400 KB |
Output is correct |
4 |
Correct |
6 ms |
604 KB |
Output is correct |
5 |
Correct |
4 ms |
604 KB |
Output is correct |
6 |
Correct |
2 ms |
604 KB |
Output is correct |
7 |
Correct |
7 ms |
604 KB |
Output is correct |
8 |
Correct |
7 ms |
604 KB |
Output is correct |
9 |
Correct |
6 ms |
604 KB |
Output is correct |
10 |
Correct |
8 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
604 KB |
Output is correct |
2 |
Correct |
4 ms |
604 KB |
Output is correct |
3 |
Correct |
7 ms |
604 KB |
Output is correct |
4 |
Correct |
7 ms |
604 KB |
Output is correct |
5 |
Correct |
4 ms |
604 KB |
Output is correct |
6 |
Correct |
2 ms |
604 KB |
Output is correct |
7 |
Correct |
7 ms |
604 KB |
Output is correct |
8 |
Correct |
4 ms |
604 KB |
Output is correct |
9 |
Correct |
4 ms |
604 KB |
Output is correct |
10 |
Correct |
6 ms |
604 KB |
Output is correct |
11 |
Correct |
5 ms |
604 KB |
Output is correct |
12 |
Correct |
6 ms |
604 KB |
Output is correct |
13 |
Correct |
8 ms |
604 KB |
Output is correct |
14 |
Correct |
15 ms |
604 KB |
Output is correct |
15 |
Correct |
22 ms |
604 KB |
Output is correct |
16 |
Partially correct |
62 ms |
604 KB |
Partially correct - number of queries: 7144 |
17 |
Correct |
6 ms |
604 KB |
Output is correct |
18 |
Partially correct |
71 ms |
604 KB |
Partially correct - number of queries: 8299 |
19 |
Correct |
7 ms |
604 KB |
Output is correct |
20 |
Correct |
33 ms |
604 KB |
Output is correct |
21 |
Correct |
32 ms |
604 KB |
Output is correct |
22 |
Correct |
11 ms |
604 KB |
Output is correct |
23 |
Correct |
6 ms |
604 KB |
Output is correct |
24 |
Correct |
4 ms |
604 KB |
Output is correct |
25 |
Correct |
21 ms |
604 KB |
Output is correct |
26 |
Correct |
54 ms |
604 KB |
Output is correct |
27 |
Correct |
7 ms |
604 KB |
Output is correct |
28 |
Partially correct |
43 ms |
604 KB |
Partially correct - number of queries: 7934 |
29 |
Partially correct |
56 ms |
604 KB |
Partially correct - number of queries: 6134 |
30 |
Partially correct |
66 ms |
604 KB |
Partially correct - number of queries: 8226 |
31 |
Correct |
6 ms |
604 KB |
Output is correct |
32 |
Correct |
10 ms |
604 KB |
Output is correct |
33 |
Correct |
2 ms |
604 KB |
Output is correct |
34 |
Correct |
27 ms |
604 KB |
Output is correct |
35 |
Correct |
9 ms |
604 KB |
Output is correct |
36 |
Correct |
11 ms |
604 KB |
Output is correct |
37 |
Correct |
6 ms |
604 KB |
Output is correct |
38 |
Correct |
6 ms |
604 KB |
Output is correct |
39 |
Correct |
39 ms |
604 KB |
Output is correct |
40 |
Partially correct |
72 ms |
604 KB |
Partially correct - number of queries: 7093 |
41 |
Partially correct |
45 ms |
604 KB |
Partially correct - number of queries: 5163 |
42 |
Partially correct |
33 ms |
604 KB |
Partially correct - number of queries: 5163 |
43 |
Correct |
44 ms |
604 KB |
Output is correct |
44 |
Correct |
35 ms |
604 KB |
Output is correct |
45 |
Correct |
15 ms |
604 KB |
Output is correct |
46 |
Correct |
6 ms |
604 KB |
Output is correct |
47 |
Correct |
36 ms |
604 KB |
Output is correct |
48 |
Partially correct |
27 ms |
604 KB |
Partially correct - number of queries: 6270 |
49 |
Correct |
6 ms |
604 KB |
Output is correct |
50 |
Partially correct |
35 ms |
604 KB |
Partially correct - number of queries: 8301 |
51 |
Correct |
40 ms |
604 KB |
Output is correct |
52 |
Correct |
6 ms |
604 KB |
Output is correct |
53 |
Correct |
5 ms |
604 KB |
Output is correct |
54 |
Correct |
34 ms |
604 KB |
Output is correct |
55 |
Correct |
4 ms |
604 KB |
Output is correct |
56 |
Partially correct |
88 ms |
604 KB |
Partially correct - number of queries: 8290 |
57 |
Partially correct |
29 ms |
604 KB |
Partially correct - number of queries: 6185 |
58 |
Partially correct |
62 ms |
604 KB |
Partially correct - number of queries: 6295 |
59 |
Partially correct |
24 ms |
604 KB |
Partially correct - number of queries: 5164 |
60 |
Correct |
55 ms |
604 KB |
Output is correct |
61 |
Correct |
4 ms |
604 KB |
Output is correct |
62 |
Correct |
4 ms |
604 KB |
Output is correct |
63 |
Correct |
8 ms |
604 KB |
Output is correct |
64 |
Correct |
4 ms |
604 KB |
Output is correct |
65 |
Correct |
12 ms |
604 KB |
Output is correct |
66 |
Correct |
45 ms |
604 KB |
Output is correct |
67 |
Correct |
6 ms |
604 KB |
Output is correct |
68 |
Correct |
6 ms |
604 KB |
Output is correct |
69 |
Correct |
57 ms |
604 KB |
Output is correct |
70 |
Correct |
7 ms |
604 KB |
Output is correct |
71 |
Partially correct |
89 ms |
604 KB |
Partially correct - number of queries: 8248 |
72 |
Correct |
12 ms |
604 KB |
Output is correct |
73 |
Partially correct |
72 ms |
604 KB |
Partially correct - number of queries: 8131 |
74 |
Partially correct |
73 ms |
604 KB |
Partially correct - number of queries: 8203 |
75 |
Correct |
8 ms |
604 KB |
Output is correct |
76 |
Partially correct |
62 ms |
604 KB |
Partially correct - number of queries: 7082 |
77 |
Partially correct |
82 ms |
604 KB |
Partially correct - number of queries: 8321 |
78 |
Correct |
10 ms |
604 KB |
Output is correct |
79 |
Correct |
33 ms |
604 KB |
Output is correct |
80 |
Partially correct |
73 ms |
604 KB |
Partially correct - number of queries: 8319 |
81 |
Partially correct |
75 ms |
604 KB |
Partially correct - number of queries: 8317 |
82 |
Partially correct |
72 ms |
604 KB |
Partially correct - number of queries: 8269 |
83 |
Correct |
6 ms |
604 KB |
Output is correct |
84 |
Partially correct |
69 ms |
604 KB |
Partially correct - number of queries: 6881 |
85 |
Partially correct |
71 ms |
604 KB |
Partially correct - number of queries: 8328 |
86 |
Incorrect |
45 ms |
604 KB |
Incorrect |
87 |
Halted |
0 ms |
0 KB |
- |