結果

問題 No.351 市松スライドパズル
ユーザー lloyz
提出日時 2023-02-23 16:07:20
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 836 ms / 2,000 ms
コード長 370 bytes
コンパイル時間 294 ms
コンパイル使用メモリ 82,040 KB
実行使用メモリ 245,500 KB
最終ジャッジ日時 2024-07-23 11:20:03
合計ジャッジ時間 9,743 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

h, w = map(int, input().split())
n = int(input())
P = []
for _ in range(n):
    s, k = input().split()
    P.append((s, int(k)))

ci, cj = 0, 0
for i in range(n - 1, -1, -1):
    s, k = P[i]
    if s == 'R' and ci == k:
        cj = (cj - 1) % w
    elif s == 'C' and cj == k:
        ci = (ci - 1) % h
if (ci + cj) % 2 == 0:
    print("white")
else:
    print("black")
0