# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
95901 | 2019-02-03T12:44:48 Z | JustInCase | popa (BOI18_popa) | C++17 | 13 ms | 676 KB |
#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 parent[MAX_N + 5]; /** int32_t Query(int32_t a, int32_t b, int32_t c, int32_t d) { std::cout << a << " " << b << " " << c << " " << d << '\n' << std::flush; int32_t res; std::cin >> res; return res; } */ int32_t Solve(int32_t n, int32_t *left, int32_t *right) { memset(parent, -1, sizeof(parent)); memset(left, -1, sizeof(left)); memset(right, -1, sizeof(right)); int32_t root = 0; for(int32_t i = 1; i < n; i++) { if(Query(0, i - 1, i, i)) { parent[root] = i; left[i] = root; root = i; continue; } int32_t curr = i - 1, possibleParent = -1; while(curr != -1) { if(right[curr] == -1 && Query(curr, curr, curr, i)) { possibleParent = curr; } curr = parent[curr]; } right[possibleParent] = i; parent[i] = possibleParent; } 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'; } } */
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 4 ms | 580 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 | 672 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 12 ms | 676 KB | Execution killed with signal 11 (could be triggered by violating memory limits) |
2 | Halted | 0 ms | 0 KB | - |