# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
647081 |
2022-10-01T14:33:21 Z |
georgievskiy |
popa (BOI18_popa) |
C++14 |
|
1 ms |
208 KB |
#include "popa.h"
#include <bits/stdc++.h>
using namespace std;
int rec(int l, int r, int* left, int* right) {
if (l >= r)
return -1;
if (l + 1 == r)
return l;
int root;
for (int i = l; i < r; i++) {
if (query(l, r + 1, i, i)) {
root = i;
break;
}
}
int l_c = rec(l, root, left, right);
int r_c = rec(root + 1, r, left, right);
left[root] = l_c, right[root] = r_c;
}
int solve(int n, int* left, int* right) {
fill(left, left + n, -1), fill(right, right + n, -1);
return rec(0, n, left, right);
}
Compilation message
popa.cpp: In function 'int rec(int, int, int*, int*)':
popa.cpp:20:32: warning: control reaches end of non-void function [-Wreturn-type]
20 | left[root] = l_c, right[root] = r_c;
| ~~~~~~~~~~~~^~~~~
popa.cpp:20:7: warning: 'root' may be used uninitialized in this function [-Wmaybe-uninitialized]
20 | left[root] = l_c, right[root] = r_c;
| ^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
208 KB |
invalid argument |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
invalid argument |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
208 KB |
invalid argument |
2 |
Halted |
0 ms |
0 KB |
- |