結果

問題 No.351 市松スライドパズル
ユーザー むらためむらため
提出日時 2019-01-19 18:00:45
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
AC  
実行時間 25 ms / 2,000 ms
コード長 1,060 bytes
コンパイル時間 2,478 ms
コンパイル使用メモリ 175,004 KB
実行使用メモリ 8,492 KB
最終ジャッジ日時 2023-09-25 05:52:21
合計ジャッジ時間 5,044 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

#pragma GCC optimize("O3")
#pragma GCC target("avx")
#include "bits/stdc++.h"

using namespace std;
#define REP(i, n) for (int i = 0; i < (n); i++)
#define FOR(i, a, b) for (int i = (a); i < (b); i++)
#define FORR(i, a, b) for (int i = (b - 1); i >= (a); i--)
#define ALL(a) begin(a), end(a)
#define let const auto
int scan() {
  int result = 0;
  while (true) {
    auto k = getchar_unlocked();
    if (k < '0') return result;
    result = 10 * result + k - '0';
  }
}
int ops[1000010];  // 16bit?
bool isC[1000010];
signed main() {
  let h = scan();
  let w = scan();
  let n = scan();
  REP(i, n) {
    isC[i] = getchar_unlocked() == 'C';
    getchar_unlocked();
    ops[i] = scan();
  }
  int x = 0;
  int y = 0;
  FORR(i, 0, n) {
    let op = ops[i];
    if (isC[i]) {
      if (x != op) continue;
      if (y == 0)
        y = h - 1;
      else
        y -= 1;
    } else {
      if (y != op) continue;
      if (x == 0)
        x = w - 1;
      else
        x -= 1;
    }
  }
  if (x % 2 == y % 2)
    printf("white\n");
  else
    printf("black\n");
}
0