#include "prize.h"
#include<bits/stdc++.h>
using namespace std;
int l,r,c,ma,b[202020];
vector<int> d[202020];
int find_best(int n) {
for(int i = 0; i < n; i++) {
if(b[i]==0)
{
b[i]=1;
d[i] = ask(i);
}
std::vector<int> res=d[i];
if(res[0] + res[1] == 0)
return i;
l=i+1;
r=n-1;
while(l<=r)
{
c=(l+r)/2;
if(b[c]==0)
{
b[c]=1;
d[c]=ask(c);
}
vector<int> hv=d[c];
if(hv==res)
{
i=c;
l=c+1;
}
else
r=c-1;
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
7544 KB |
Output is correct |
2 |
Correct |
0 ms |
7544 KB |
Output is correct |
3 |
Correct |
5 ms |
7544 KB |
Output is correct |
4 |
Correct |
3 ms |
7544 KB |
Output is correct |
5 |
Correct |
0 ms |
7544 KB |
Output is correct |
6 |
Correct |
3 ms |
7544 KB |
Output is correct |
7 |
Correct |
0 ms |
7544 KB |
Output is correct |
8 |
Correct |
0 ms |
7544 KB |
Output is correct |
9 |
Correct |
4 ms |
7544 KB |
Output is correct |
10 |
Correct |
6 ms |
7544 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
7544 KB |
Output is correct |
2 |
Correct |
0 ms |
7544 KB |
Output is correct |
3 |
Correct |
1 ms |
7544 KB |
Output is correct |
4 |
Correct |
0 ms |
7544 KB |
Output is correct |
5 |
Correct |
1 ms |
7544 KB |
Output is correct |
6 |
Correct |
1 ms |
7544 KB |
Output is correct |
7 |
Correct |
1 ms |
7544 KB |
Output is correct |
8 |
Correct |
0 ms |
7544 KB |
Output is correct |
9 |
Correct |
0 ms |
7544 KB |
Output is correct |
10 |
Correct |
3 ms |
7544 KB |
Output is correct |
11 |
Correct |
3 ms |
7544 KB |
Output is correct |
12 |
Correct |
4 ms |
7544 KB |
Output is correct |
13 |
Correct |
10 ms |
7544 KB |
Output is correct |
14 |
Correct |
5 ms |
7544 KB |
Output is correct |
15 |
Correct |
0 ms |
7676 KB |
Output is correct |
16 |
Incorrect |
19 ms |
7808 KB |
Incorrect |
17 |
Halted |
0 ms |
0 KB |
- |