#include "popa.h"
#include <bits/stdc++.h>
#define pb push_back
#define pii pair < int, int >
#define fr first
#define sc second
#define mk make_pair
using namespace std;
const int N = (int)1e3 + 7;
int pr[N];
int solve(int n, int left[], int right[]) {
for (int i = 0; i < n; i++) {
left[i] = right[i] = -1;
pr[i] = -1;
}
for (int i = 0; i < n; i++) {
int asd;
if (!i) {
asd = query(i, i, i, i + 1);
if (asd) {
pr[i + 1] = i;
right[i] = i + 1;
} else {
pr[i] = i + 1;
left[i + 1] = i;
}
} else if (i < n) {
asd = query(i, i, i - 1, i);
if (asd) {
pr[i - 1] = i;
left[i] = i - 1;
} else {
pr[i] = i - 1;
right[i - 1] = i;
}
} else {
asd = query(i, i, i - 1, i);
if (asd) {
pr[i - 1] = i;
left[i] = i - 1;
} else {
pr[i] = i - 1;
right[i - 1] = i;
}
asd = query(i, i, i, i + 1);
if (asd) {
pr[i + 1] = i;
right[i] = i + 1;
} else {
pr[i] = i + 1;
left[i + 1] = i;
}
}
}
int temp = 0;
while (pr[temp] != -1) {
temp = pr[temp];
}
return temp;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
5 ms |
632 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
13 ms |
716 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
7 ms |
848 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |