結果

問題 No.870 無敵囲い
ユーザー @abcde@abcde
提出日時 2019-08-30 21:34:16
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 300 ms
コード長 1,149 bytes
コンパイル時間 1,403 ms
コンパイル使用メモリ 165,236 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-11 16:09:38
合計ジャッジ時間 2,334 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

int main(){
    
    // 1. 入力情報取得.
    int N;
    scanf("%d", &N);
    pair<int, int> a = {2, 8}, b = {3, 9}, c = {7, 9};
    for(int i = 0; i < N; i++){
        int xb, yb, xa, ya;
        scanf("%d %d %d %d", &xb, &yb, &xa, &ya);
        // 座標更新(駒A).
        if(xb == a.first && yb == a.second){
            a.first = xa;
            a.second = ya;
            continue;
        }
        // 座標更新(駒B).
        if(xb == b.first && yb == b.second){
            b.first = xa;
            b.second = ya;
            continue;
        }
        // 座標更新(駒C).
        if(xb == c.first && yb == c.second){
            c.first = xa;
            c.second = ya;
            continue;
        }
    }
    
    // 2. 移動後をチェック.
    bool ans = true;
    // 駒A.
    if(a.first != 5 || a.second != 8) ans = false;
    // 駒B.
    if(b.first != 4 || b.second != 8) ans = false;
    // 駒C.
    if(c.first != 6 || c.second != 8) ans = false;
    
    // 3. 後処理.
    if(ans) printf("%s\n", "YES");
    else    printf("%s\n", "NO");
    return 0;
    
}
0