#include "prize.h"
#include<bits/stdc++.h>
using namespace std;
int l,r,c,ma;
int find_best(int n) {
for(int i = 0; i < n; i++) {
std::vector<int> res = ask(i);
if(res[0] + res[1] == 0)
return i;
// ma=max(ma,res[0]+res[1]);
// if(res[0]+res[1]<ma)
// continue;
l=i+1;
r=n-1;
while(l<=r)
{
c=(l+r)/2;
vector<int> hv=ask(c);
if(hv==res)
{
i=c;
l=c+1;
}
else
r=c-1;
}
}
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
2020 KB |
Output is correct |
2 |
Correct |
1 ms |
2020 KB |
Output is correct |
3 |
Correct |
0 ms |
2020 KB |
Output is correct |
4 |
Correct |
0 ms |
2020 KB |
Output is correct |
5 |
Correct |
1 ms |
2020 KB |
Output is correct |
6 |
Correct |
0 ms |
2020 KB |
Output is correct |
7 |
Correct |
1 ms |
2020 KB |
Output is correct |
8 |
Correct |
1 ms |
2020 KB |
Output is correct |
9 |
Correct |
1 ms |
2020 KB |
Output is correct |
10 |
Correct |
1 ms |
2020 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
2020 KB |
Output is correct |
2 |
Correct |
0 ms |
2020 KB |
Output is correct |
3 |
Correct |
1 ms |
2020 KB |
Output is correct |
4 |
Correct |
0 ms |
2020 KB |
Output is correct |
5 |
Correct |
1 ms |
2020 KB |
Output is correct |
6 |
Correct |
0 ms |
2020 KB |
Output is correct |
7 |
Correct |
1 ms |
2020 KB |
Output is correct |
8 |
Correct |
1 ms |
2020 KB |
Output is correct |
9 |
Correct |
0 ms |
2020 KB |
Output is correct |
10 |
Correct |
0 ms |
2020 KB |
Output is correct |
11 |
Correct |
1 ms |
2020 KB |
Output is correct |
12 |
Correct |
0 ms |
2020 KB |
Output is correct |
13 |
Correct |
1 ms |
2020 KB |
Output is correct |
14 |
Correct |
2 ms |
2020 KB |
Output is correct |
15 |
Correct |
10 ms |
2020 KB |
Output is correct |
16 |
Incorrect |
30 ms |
2020 KB |
Incorrect |
17 |
Halted |
0 ms |
0 KB |
- |