#include "prize.h"
#include <bits/stdc++.h>
using namespace std;
int bbi(int ini, int fim) {
if(ini==fim) return ini-1;
int mid=ini+fim; mid/=2;
vector<int> aux=ask(mid-1);
// printf("%d %d :: %d >> %d %d\n", ini, fim, mid, aux[0], aux[1]);
if(aux[0]==aux[1]&&aux[0]==0) return mid-1;
if(aux[0]) return bbi(ini, mid-1);
else return bbi(mid+1, fim);
}
int find_best(int n) {
// printf("asd %d\n", bbi(1, n));
return bbi(1, n);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
392 KB |
Output is correct |
2 |
Correct |
2 ms |
396 KB |
Output is correct |
3 |
Correct |
2 ms |
248 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
248 KB |
Output is correct |
6 |
Correct |
2 ms |
248 KB |
Output is correct |
7 |
Correct |
3 ms |
248 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
248 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
248 KB |
Output is correct |
3 |
Correct |
2 ms |
304 KB |
Output is correct |
4 |
Correct |
2 ms |
248 KB |
Output is correct |
5 |
Correct |
2 ms |
248 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
248 KB |
Output is correct |
8 |
Correct |
2 ms |
376 KB |
Output is correct |
9 |
Correct |
2 ms |
380 KB |
Output is correct |
10 |
Correct |
2 ms |
380 KB |
Output is correct |
11 |
Incorrect |
2 ms |
248 KB |
answer is not correct |
12 |
Halted |
0 ms |
0 KB |
- |