結果

問題 No.1941 CHECKER×CHECKER(1)
ユーザー skojijiskojiji
提出日時 2022-05-20 23:54:16
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 1,927 bytes
コンパイル時間 2,209 ms
コンパイル使用メモリ 210,500 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-20 14:51:04
合計ジャッジ時間 3,035 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
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 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 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 <bits/stdc++.h>

#include <atcoder/mincostflow>
#include <atcoder/modint>

using namespace atcoder;
using namespace std;
#define REP(i, m, n) for (int64_t i = (int64_t)(m); i < (int64_t)(n); i++)
#define rep(i, n) REP(i, 0, n)
#define RREP(i, m, n) for (int64_t i = (int64_t)(m - 1); i >= (int64_t)(n); i--)
#define rrep(i, n) RREP(i, n, 0)
#define all(v) v.begin(), v.end()
using vi = vector<int64_t>;
using vvi = vector<vi>;
using vb = vector<bool>;
using vvb = vector<vb>;
using vc = vector<char>;
using vvc = vector<vc>;
using vs = vector<string>;
using vvs = vector<vs>;
using vd = vector<long double>;
using vvd = vector<vd>;
using pii = pair<int64_t, int64_t>;
using tii = tuple<int64_t, int64_t, int64_t>;
using vp = vector<pii>;
using vvp = vector<vp>;
using vt = vector<tii>;
using vvt = vector<vt>;
using mint = modint;
using vm = vector<mint>;
using vvm = vector<vm>;
using mii = map<int64_t, int64_t>;
using pdi = pair<long double, int64_t>;
using tdi = tuple<long double, int64_t, int64_t>;
const int64_t INF = 2e18;
const vp dxy = {{0, -1}, {-1, 0}, {0, 1}, {1, 0}};

template <typename T>
bool chmax(T &a, const T &b) {
  if (a < b) {
    a = b;
    return true;
  }
  return false;
}

template <typename T>
bool chmin(T &a, const T &b) {
  if (a > b) {
    a = b;
    return true;
  }
  return false;
}

int64_t to_int(char c) { return c - 'A'; }

int64_t n = 3;

bool check_inner(vvc &s, int64_t x, int64_t y) {
  for (auto [dx, dy] : dxy) {
    int64_t next_x = x + dx, next_y = y + dy;
    if (next_x < 0 || next_x >= n || next_y < 0 || next_y >= n) continue;

    if (s[x][y] == s[next_x][next_y]) return false;
  }

  return true;
}

bool check(vvc &s) {
  rep(i, n) rep(j, n) {
    if (!check_inner(s, i, j)) return false;
  }

  return true;
}

int main() {
  vvc s(n, vc(n));
  rep(i, n) rep(j, n) cin >> s[i][j];

  if (check(s))
    cout << "Yes" << endl;
  else
    cout << "No" << endl;
}
0