結果
| 問題 | No.870 無敵囲い | 
| コンテスト | |
| ユーザー |  | 
| 提出日時 | 2020-05-21 21:56:14 | 
| 言語 | C++14 (gcc 13.3.0 + boost 1.87.0) | 
| 結果 | 
                                AC
                                 
                             | 
| 実行時間 | 2 ms / 300 ms | 
| コード長 | 1,009 bytes | 
| コンパイル時間 | 651 ms | 
| コンパイル使用メモリ | 68,928 KB | 
| 実行使用メモリ | 6,948 KB | 
| 最終ジャッジ日時 | 2024-06-29 06:41:15 | 
| 合計ジャッジ時間 | 1,088 ms | 
| ジャッジサーバーID (参考情報) | judge4 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 3 | 
| other | AC * 18 | 
ソースコード
#include<iostream>
#include<vector>
using namespace std;
struct koma {
    int x;
    int y;
    void kin(int x0, int y0) {
        x = x0;
        y = y0;
        return;
    }
    bool kcheck(int x0, int y0) {
        if(x0 == x && y0 == y){
            return true;
        } else {
            return false;
        }
    }
    void kout() {
        cout << "(" << x << ", " << y << ")" << endl;
    }
};
int main() {
    int n;
    cin >> n;
    vector<koma> k(3);
    k[0].kin(2, 8);
    k[1].kin(3, 9);
    k[2].kin(7, 9);
    for(int i=0; i<n; i++) {
        int x0, y0, x1, y1;
        cin >> x0 >> y0 >> x1 >> y1;
        for(int j=0; j<3; j++) {
            if(k[j].kcheck(x0, y0)){
                k[j].kin(x1, y1);
                break;
            }
        }
    }
    /*
    k[0].kout();
    k[1].kout();
    k[2].kout();
    */
    if(k[0].kcheck(5, 8) && k[1].kcheck(4, 8) &&  k[2].kcheck(6, 8)){
        cout << "YES" << endl;
    } else {
        cout << "NO" << endl;
    }
}
            
            
            
        