#include <bits/stdc++.h>
#include "popa.h"
#define int32_t int
#define int64_t long long
#define Solve solve
#define Query query
const int32_t MAX_N = 1000;
int32_t Solve(int32_t n, int32_t *left, int32_t *right) {
memset(left, -1, n * 4);
memset(right, -1, n * 4);
int32_t root;
if(Query(0, 1, 0, 0)) {
root = 0;
right[0] = 1;
}
else {
root = 1;
left[1] = 0;
}
for(int32_t i = 2; i < n; i++) {
if(Query(i - 1, i, i, i)) {
left[i] = root;
root = i;
}
else {
right[i - 1] = i;
}
}
return root;
}
/**
int main() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(nullptr);
int32_t left[6], right[6];
int32_t ans = Solve(6, left, right);
std::cout << ans << '\n';
for(int32_t i = 0; i < 6; i++) {
std::cout << left[i] << " " << right[i] << '\n';
}
}
*/
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
2 ms |
312 KB |
not a valid solution |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
12 ms |
420 KB |
not a valid solution |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
11 ms |
372 KB |
not a valid solution |
2 |
Halted |
0 ms |
0 KB |
- |