結果

問題 No.870 無敵囲い
ユーザー YumekumoYumekumo
提出日時 2020-05-21 21:56:14
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 300 ms
コード長 1,009 bytes
コンパイル時間 545 ms
コンパイル使用メモリ 68,180 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-11 16:33:30
合計ジャッジ時間 1,383 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,376 KB
testcase_02 AC 2 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 2 ms
4,380 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,380 KB
testcase_09 AC 2 ms
4,380 KB
testcase_10 AC 2 ms
4,380 KB
testcase_11 AC 2 ms
4,380 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,380 KB
testcase_14 AC 1 ms
4,376 KB
testcase_15 AC 1 ms
4,376 KB
testcase_16 AC 1 ms
4,376 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 AC 1 ms
4,380 KB
testcase_20 AC 2 ms
4,376 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
    }

}
0