#include<iostream>
#include<vector>
#include "prize.h"
using namespace std;
int find_best(int n){
int nr, p, st, dr, mid;
vector<int> a;
a = ask(0);
if(a[1] == 0){
return 0;
}
p = 0;
nr = a[1];
while(nr > 0){
st = p + 1;
dr = n;
while(st <= dr){
mid = (st + dr) / 2;
a = ask(mid);
if(a[1] == nr){
st = mid + 1;
}
else{
dr = mid - 1;
}
}
a = ask(st);
if(a[1] == 0){
return st;
}
p = st + 1;
nr--;
}
}
Compilation message
prize.cpp: In function 'int find_best(int)':
prize.cpp:34:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
248 KB |
Output is correct |
2 |
Correct |
2 ms |
248 KB |
Output is correct |
3 |
Correct |
2 ms |
248 KB |
Output is correct |
4 |
Correct |
2 ms |
252 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
376 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
8 |
Correct |
3 ms |
248 KB |
Output is correct |
9 |
Correct |
4 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
248 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
248 KB |
Output is correct |
3 |
Correct |
2 ms |
312 KB |
Output is correct |
4 |
Correct |
2 ms |
504 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
2 ms |
508 KB |
Output is correct |
7 |
Correct |
2 ms |
252 KB |
Output is correct |
8 |
Correct |
2 ms |
248 KB |
Output is correct |
9 |
Correct |
2 ms |
376 KB |
Output is correct |
10 |
Correct |
2 ms |
248 KB |
Output is correct |
11 |
Correct |
3 ms |
376 KB |
Output is correct |
12 |
Correct |
2 ms |
248 KB |
Output is correct |
13 |
Correct |
5 ms |
424 KB |
Output is correct |
14 |
Correct |
6 ms |
248 KB |
Output is correct |
15 |
Correct |
8 ms |
308 KB |
Output is correct |
16 |
Partially correct |
37 ms |
376 KB |
Partially correct - number of queries: 6943 |
17 |
Correct |
2 ms |
376 KB |
Output is correct |
18 |
Partially correct |
75 ms |
308 KB |
Partially correct - number of queries: 8135 |
19 |
Correct |
2 ms |
380 KB |
Output is correct |
20 |
Correct |
13 ms |
504 KB |
Output is correct |
21 |
Correct |
31 ms |
252 KB |
Output is correct |
22 |
Correct |
7 ms |
312 KB |
Output is correct |
23 |
Correct |
2 ms |
376 KB |
Output is correct |
24 |
Correct |
2 ms |
376 KB |
Output is correct |
25 |
Correct |
37 ms |
376 KB |
Output is correct |
26 |
Correct |
43 ms |
248 KB |
Output is correct |
27 |
Correct |
3 ms |
248 KB |
Output is correct |
28 |
Partially correct |
41 ms |
380 KB |
Partially correct - number of queries: 7756 |
29 |
Partially correct |
60 ms |
248 KB |
Partially correct - number of queries: 5889 |
30 |
Partially correct |
85 ms |
308 KB |
Partially correct - number of queries: 8085 |
31 |
Correct |
3 ms |
248 KB |
Output is correct |
32 |
Correct |
4 ms |
504 KB |
Output is correct |
33 |
Correct |
2 ms |
376 KB |
Output is correct |
34 |
Correct |
31 ms |
376 KB |
Output is correct |
35 |
Correct |
4 ms |
248 KB |
Output is correct |
36 |
Correct |
11 ms |
504 KB |
Output is correct |
37 |
Correct |
3 ms |
248 KB |
Output is correct |
38 |
Correct |
2 ms |
376 KB |
Output is correct |
39 |
Correct |
43 ms |
248 KB |
Output is correct |
40 |
Partially correct |
71 ms |
376 KB |
Partially correct - number of queries: 6907 |
41 |
Correct |
52 ms |
248 KB |
Output is correct |
42 |
Correct |
34 ms |
248 KB |
Output is correct |
43 |
Correct |
46 ms |
248 KB |
Output is correct |
44 |
Correct |
33 ms |
248 KB |
Output is correct |
45 |
Correct |
15 ms |
308 KB |
Output is correct |
46 |
Correct |
2 ms |
248 KB |
Output is correct |
47 |
Correct |
29 ms |
376 KB |
Output is correct |
48 |
Partially correct |
32 ms |
380 KB |
Partially correct - number of queries: 6030 |
49 |
Correct |
10 ms |
248 KB |
Output is correct |
50 |
Partially correct |
76 ms |
376 KB |
Partially correct - number of queries: 8135 |
51 |
Correct |
24 ms |
380 KB |
Output is correct |
52 |
Correct |
3 ms |
248 KB |
Output is correct |
53 |
Correct |
3 ms |
248 KB |
Output is correct |
54 |
Correct |
20 ms |
376 KB |
Output is correct |
55 |
Correct |
2 ms |
504 KB |
Output is correct |
56 |
Partially correct |
85 ms |
248 KB |
Partially correct - number of queries: 8140 |
57 |
Partially correct |
60 ms |
248 KB |
Partially correct - number of queries: 5958 |
58 |
Partially correct |
61 ms |
248 KB |
Partially correct - number of queries: 6059 |
59 |
Correct |
60 ms |
248 KB |
Output is correct |
60 |
Correct |
46 ms |
376 KB |
Output is correct |
61 |
Correct |
3 ms |
376 KB |
Output is correct |
62 |
Correct |
2 ms |
376 KB |
Output is correct |
63 |
Correct |
3 ms |
248 KB |
Output is correct |
64 |
Correct |
2 ms |
396 KB |
Output is correct |
65 |
Incorrect |
2 ms |
304 KB |
answer is not correct |
66 |
Halted |
0 ms |
0 KB |
- |