結果

問題 No.351 市松スライドパズル
ユーザー norioc
提出日時 2025-02-20 04:27:00
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 678 ms / 2,000 ms
コード長 426 bytes
コンパイル時間 810 ms
コンパイル使用メモリ 82,240 KB
実行使用メモリ 245,696 KB
最終ジャッジ日時 2025-02-20 04:27:12
合計ジャッジ時間 9,270 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

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

r = 0
c = 0
for s, k in reversed(moves):
    match s:
        case 'R':
            if r == k:
                c = (c - 1) % W
        case 'C':
            if c == k:
                r = (r - 1) % H

if (r + c) % 2 == 0:
    print('white')
else:
    print('black')
0