#include <bits/stdc++.h>
#include "popa.h"
using namespace std;
const int N = 1005;
int par[N];
int solve(int n, int* L, int* R) {
memset(par, -1, sizeof par);
L[0] = R[0] = -1;
for (int i = 1; i < n; ++i) {
int cur = i - 1;
L[i] = R[i] = -1;
while (1) {
if(query(cur, i, i, i)){
if (par[cur] == -1){
par[cur] = i, L[i] = cur; break;
}
else cur = par[cur];
}
else {
if (R[cur] == -1) R[cur] = i, par[i] = cur;
else par[R[cur]] = i, par[i] = cur, L[i] = R[cur], R[cur] = i;
break;
}
}
}
int root = 0;
for (int i = 0; i < n; ++i) if (par[i] == -1) root = i;
return root;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
15 ms |
248 KB |
Output is correct |
2 |
Correct |
13 ms |
376 KB |
Output is correct |
3 |
Correct |
11 ms |
252 KB |
Output is correct |
4 |
Correct |
17 ms |
376 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
91 ms |
376 KB |
Output is correct |
2 |
Correct |
101 ms |
324 KB |
Output is correct |
3 |
Correct |
61 ms |
328 KB |
Output is correct |
4 |
Correct |
84 ms |
328 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
103 ms |
376 KB |
Output is correct |
2 |
Correct |
85 ms |
332 KB |
Output is correct |
3 |
Correct |
81 ms |
332 KB |
Output is correct |
4 |
Correct |
68 ms |
324 KB |
Output is correct |