結果

問題 No.870 無敵囲い
ユーザー gemy
提出日時 2023-11-22 09:18:35
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 300 ms
コード長 731 bytes
コンパイル時間 1,774 ms
コンパイル使用メモリ 195,048 KB
最終ジャッジ日時 2025-02-17 22:54:22
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

// #define _GLIBCXX_DEBUG
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); ++i)
int main() {
    // Input 
    int N;
    cin >> N;
    vector<int> x1(N), y1(N), x2(N), y2(N);
    rep(i, N) cin >> x1[i] >> y1[i] >> x2[i] >> y2[i];

    // Simulate
    pair<int, int> koma[3] = {{2, 8}, {3, 9}, {7, 9}};
    rep(i, N) {
        rep(j, 3) {
            if (koma[j] == make_pair(x1[i], y1[i])) {
                koma[j] = {x2[i], y2[i]};
                break;
            }
        }
    }

    // Judge
    pair<int, int> _koma[3] = {{5, 8}, {4, 8}, {6, 8}};
    bool ok = true;
    rep(i, 3) if (koma[i] != _koma[i]) ok = false;

    // Output
    cout << (ok ? "YES" : "NO") << endl;
}
0