# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
59772 |
2018-07-23T05:21:19 Z |
model_code |
popa (BOI18_popa) |
C++17 |
|
192 ms |
664 KB |
#include <bits/stdc++.h>
#include "popa.h"
using namespace std;
const int MaxN = 10010;
int lf[MaxN], rg[MaxN];
int dfs(int l, int r) {
if (l > r) return -1;
int a = l, b = r;
while (1) {
if (query(l, r, a, a)) {
lf[a] = dfs(l, a - 1);
rg[a] = dfs(a + 1, r);
return a;
}
if (query(l, r, b, b)) {
lf[b] = dfs(l, b - 1);
rg[b] = dfs(b + 1, r);
return b;
}
a++;
b--;
}
}
int solve(int n, int* left, int* right) {
int root = dfs(0, n - 1);
for (int i = 0; i < n; i++) {
left[i] = lf[i];
right[i] = rg[i];
}
return root;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
15 ms |
300 KB |
Output is correct |
2 |
Correct |
21 ms |
436 KB |
Output is correct |
3 |
Correct |
39 ms |
436 KB |
Output is correct |
4 |
Correct |
20 ms |
444 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
192 ms |
664 KB |
Output is correct |
2 |
Correct |
131 ms |
664 KB |
Output is correct |
3 |
Correct |
144 ms |
664 KB |
Output is correct |
4 |
Correct |
181 ms |
664 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
29 ms |
664 KB |
too many queries |
2 |
Halted |
0 ms |
0 KB |
- |