結果

問題 No.351 市松スライドパズル
コンテスト
ユーザー H3PO4
提出日時 2020-06-25 15:28:39
言語 Python3
(3.14.3 + numpy 2.4.2 + scipy 1.17.0)
コンパイル:
python3 -mpy_compile _filename_
実行:
python3 _filename_
結果
AC  
実行時間 1,541 ms / 2,000 ms
コード長 381 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 464 ms
コンパイル使用メモリ 20,952 KB
実行使用メモリ 115,548 KB
最終ジャッジ日時 2026-03-25 04:39:19
合計ジャッジ時間 18,840 ms
ジャッジサーバーID
(参考情報)
judge3_0 / judge2_1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

H, W = map(int, input().split())
N = int(input())
Q = []
for _ in range(N):
    S, K = input().split()
    K = int(K)
    Q.append((S, K))

cur_x, cur_y = 0, 0
for s, k in reversed(Q):
    if s == 'R':
        if cur_x == k:
            cur_y = (cur_y - 1) % W
    else:
        if cur_y == k:
            cur_x = (cur_x - 1) % H
print('black' if (cur_x + cur_y) % 2 else 'white')
0