結果

問題 No.870 無敵囲い
ユーザー godai12godai12
提出日時 2019-09-01 17:50:17
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 2 ms / 300 ms
コード長 986 bytes
コンパイル時間 1,769 ms
コンパイル使用メモリ 174,612 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-06-29 06:22:06
合計ジャッジ時間 2,455 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 18
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#define REP(i, n) for(int i = 0; i < n; i++)
#define REPR(i, n) for(int i = n; i >= 0; i--)
#define FOR(i, m, n) for(int i = m; i < n; i++)
#define INF 2e9
#define ALL(v) v.begin(), v.end()
using namespace std;
typedef long long ll;
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    int n;
    cin >> n;

    vector<vector<int>> from(n, vector<int>(2));
    vector<vector<int>> to(n, vector<int>(2));

    vector<vector<int>> start{{2,8}, {3, 9}, {7, 9}};
    vector<vector<int>> goal{{5,8}, {4, 8}, {6, 8}};
    vector<int> current{0, 0};


    REP(i, n)
    {
        cin >> from[i][0] >> from[i][1];
        cin >> to[i][0] >> to[i][1];
    }

    string ans = "YES";

    REP(i, 3)
    {
        current = start[i];
        REP(j, n)
        {
            if(current == from[j])current = to[j];
        }

        if(current != goal[i])
        {
            ans = "NO";
            break;
        }
    }

    cout << ans << endl;

}
0