結果

問題 No.1941 CHECKER×CHECKER(1)
ユーザー srjywrdnprkt
提出日時 2023-06-29 11:45:31
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 3 ms / 2,000 ms
コード長 607 bytes
コンパイル時間 2,021 ms
コンパイル使用メモリ 195,640 KB
最終ジャッジ日時 2025-02-15 03:02:38
ジャッジサーバーID
(参考情報)
judge2 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 12
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

using namespace std;
using ll = long long;

int main(){

    int dx[4] = {1, 0, -1, 0};
    int dy[4] = {0, 1, 0, -1};
    int nh, nw;
    bool f=1;

    vector<string> S(3);
    for (int i=0; i<3; i++) cin >> S[i];

    for (int h=0; h<3; h++){
        for (int w=0; w<3; w++){
            for (int i=0; i<4; i++){
                nh = h+dx[i];
                nw = w+dy[i];
                if (nh < 0 || nh >= 3 || nw < 0 || nw >= 3) continue;
                if (S[h][w] == S[nh][nw]) f=0;
            }
        }
    }

    cout << (f ? "Yes" : "No") << endl;

    return 0;
}
0