#include "prize.h"
#include <bits/stdc++.h>
using namespace std;
vector<int> ans[210000];
int mx = -1, s = -1, L, R;
void find(int l, int r){
if(s != -1 || r < L || l > R){
return;
}
int m = (l + r) >> 1;
ans[m] = ask(m);
if(ans[m][0] == 0){
if(ans[m][1] == 0){
s = m;
return;
}
L = m + 1;
}
if(ans[m][1] == 0){
R = m - 1;
}
if(ans[m][0] == ans[l][0]){
find(m + 1, r);
} else if(ans[m][1] == ans[r][1]){
find(l - 1, m);
}
}
int find_best(int n) {
L = 0;
R = n - 1;
ans[0] = ask(0);
ans[n - 1] = ask(n - 1);
if(ans[0][0] + ans[0][1] == 0){
return 0;
}
if(ans[n - 1][0] + ans[n - 1][1] == 0){
return n - 1;
}
find(0, n - 1);
}
Compilation message
prize.cpp: In function 'int find_best(int)':
prize.cpp:46:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
14 ms |
10232 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
15 ms |
10392 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |