# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
719359 |
2023-04-05T20:18:20 Z |
rainboy |
popa (BOI18_popa) |
C++17 |
|
98 ms |
404 KB |
#include "popa.h"
#define N 1000
int qu[N];
int solve(int n, int *ll, int *rr) {
int cnt, cnt_, h, i;
cnt = 0;
for (i = 0; i < n; i++) {
cnt_ = cnt;
while (cnt_ && !query(qu[cnt_ - 1], i - 1, qu[cnt_ - 1], i))
cnt_--;
if (cnt_ < cnt) {
ll[i] = qu[cnt_];
for (h = cnt_; h < cnt; h++)
rr[qu[h]] = h + 1 < cnt ? qu[h + 1] : -1;
} else
ll[i] = -1;
cnt = cnt_;
qu[cnt++] = i;
}
for (h = 0; h < cnt; h++)
rr[qu[h]] = h + 1 < cnt ? qu[h + 1] : -1;
return qu[0];
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
9 ms |
208 KB |
Output is correct |
2 |
Correct |
8 ms |
208 KB |
Output is correct |
3 |
Correct |
15 ms |
208 KB |
Output is correct |
4 |
Correct |
8 ms |
208 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
80 ms |
400 KB |
Output is correct |
2 |
Correct |
98 ms |
276 KB |
Output is correct |
3 |
Correct |
64 ms |
280 KB |
Output is correct |
4 |
Correct |
96 ms |
396 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
93 ms |
280 KB |
Output is correct |
2 |
Correct |
87 ms |
404 KB |
Output is correct |
3 |
Correct |
81 ms |
312 KB |
Output is correct |
4 |
Correct |
67 ms |
288 KB |
Output is correct |