#include"prize.h"
#include<bits/stdc++.h>
using namespace std;
vector<vector<int>> seg(200005, {-1, -1});
int ans = -1;
void check(int i) {
if (seg[i][0] == seg[i][1] && seg[i][0] == 0) {
ans = i;
}
}
void Ask(int i) {
if (seg[i][0] != -1) {
seg[i] = ask(i);
check(i);
}
}
void calc(int l, int r) {
if (l == r || ans != -1) {
return;
}
int m = (l+r)/2;
Ask(l);
Ask(m);
if (seg[l] != seg[m] || seg[m][0]-seg[l][0] != 0) {
calc(l, m);
}
if (ans != -1) {
return;
}
Ask(m+1);
Ask(r);
if (seg[m+1] != seg[r] || seg[r][0]-seg[m+1][0] != 0) {
calc(m+1, r);
}
}
int find_best(int n) {
calc(0, n-1);
return ans;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
11240 KB |
Integer -1 violates the range [0, 199999] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
11 ms |
11352 KB |
Integer -1 violates the range [0, 199999] |
2 |
Halted |
0 ms |
0 KB |
- |