結果

問題 No.351 市松スライドパズル
ユーザー gorugo30
提出日時 2021-03-20 13:46:42
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 520 ms / 2,000 ms
コード長 382 bytes
コンパイル時間 320 ms
コンパイル使用メモリ 82,432 KB
実行使用メモリ 232,704 KB
最終ジャッジ日時 2024-11-20 22:56:09
合計ジャッジ時間 7,023 ms
ジャッジサーバーID
(参考情報)
judge4 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

H, W = map(int, input().split())
N = int(input())
op = [list(input().split()) for i in range(N)]
op = op[::-1]
r, c = 0, 0
for i in range(N):
    if op[i][0] == "R" and int(op[i][1]) == r:
        c = (c - 1) % W
    if op[i][0] == "C" and int(op[i][1]) == c:
        r = (r - 1) % H
if (r + c) % 2:
    print("black")
else:
    print("white")
0