# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
95839 | 2019-02-02T21:44:50 Z | JustInCase | popa (BOI18_popa) | C++17 | 0 ms | 0 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; std::vector< int32_t > l[MAX_N + 5], r[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::cout << std::flush; int32_t res; std::cin >> res; return res; } 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; } } } /** 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'; } } */