結果

問題 No.1941 CHECKER×CHECKER(1)
ユーザー mmn15277198mmn15277198
提出日時 2022-05-21 03:44:22
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 739 bytes
コンパイル時間 786 ms
コンパイル使用メモリ 95,452 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-20 15:33:05
合計ジャッジ時間 1,918 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

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

ソースコード

diff #

#include <iostream>
#include <vector>
#include <algorithm>
#include <functional>
#include <queue>
#include <map>
#include <cmath>
#include <iomanip>
#include <set>
#include <cstdio>
#include <string>

using namespace std;

const int dx[] = {0,0,-1,1};
const int dy[] = {-1,1,0,0};

int main() {
  vector<string> s(3);
  for (int i = 0; i < 3; i++) {
    cin >> s[i];
  }
  bool ok = true;
  for (int i = 0; i < 3; i++) {
    for (int j = 0; j < 3; j++) {
      for (int k = 0; k < 4; k++) {
        int ny = i + dx[k];
        int nx = j + dy[k];
        if (nx < 0 || ny < 0 || nx >= 3 || ny >= 3) {
          continue;
        }
        ok &= (s[i][j] != s[ny][nx]);
      }
    }
  }
  cout << (ok? "Yes" : "No") << endl;
  return 0; 
}
0