#include "prize.h"
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pii;
typedef vector<int> vi;
typedef vector<pii> vpi;
#define FOR(i,a,b) for(int i=(a);i<(b);++i)
#define F0R(i,b) FOR(i,0,b)
#define ROF(i,a,b) for(int i=(b)-1;i>=(a);--i)
#define R0F(i,b) ROF(i,0,b)
#define all(x) begin(x),end(x)
#define push_back pb;
#define trav(a,x) for(auto&a:x)
#define sz(x) int(x.size())
bool check(int mid)
{
vi res = ask(mid);
int lcnt = res[0];
return lcnt==0;
}
int find_best(int n) {
int lef=0;
int rig=n-1;
int ans=-1;
while(lef<=rig)
{
int mid=(lef+rig)/2;
if(check(mid))
{
lef=mid+1;
ans=mid;
}
else
{
rig=mid-1;
}
}
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
264 KB |
Output is correct |
2 |
Correct |
1 ms |
300 KB |
Output is correct |
3 |
Correct |
1 ms |
276 KB |
Output is correct |
4 |
Correct |
1 ms |
200 KB |
Output is correct |
5 |
Correct |
1 ms |
280 KB |
Output is correct |
6 |
Correct |
1 ms |
200 KB |
Output is correct |
7 |
Correct |
1 ms |
280 KB |
Output is correct |
8 |
Correct |
1 ms |
200 KB |
Output is correct |
9 |
Correct |
1 ms |
200 KB |
Output is correct |
10 |
Correct |
1 ms |
200 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
280 KB |
Output is correct |
2 |
Correct |
1 ms |
276 KB |
Output is correct |
3 |
Correct |
1 ms |
284 KB |
Output is correct |
4 |
Correct |
1 ms |
292 KB |
Output is correct |
5 |
Correct |
1 ms |
200 KB |
Output is correct |
6 |
Correct |
1 ms |
200 KB |
Output is correct |
7 |
Correct |
1 ms |
200 KB |
Output is correct |
8 |
Correct |
1 ms |
280 KB |
Output is correct |
9 |
Correct |
1 ms |
280 KB |
Output is correct |
10 |
Correct |
1 ms |
200 KB |
Output is correct |
11 |
Incorrect |
1 ms |
284 KB |
answer is not correct |
12 |
Halted |
0 ms |
0 KB |
- |