結果

問題 No.351 市松スライドパズル
ユーザー ebicochineal
提出日時 2016-03-12 05:00:22
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 788 ms / 2,000 ms
コード長 392 bytes
コンパイル時間 141 ms
コンパイル使用メモリ 82,632 KB
実行使用メモリ 242,560 KB
最終ジャッジ日時 2024-09-25 02:01:34
合計ジャッジ時間 9,394 ms
ジャッジサーバーID
(参考情報)
judge5 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

H, W = map(int, input().split())
N = int(input())
R = range(N)
S = [input().split() for _ in R]
p = [0, 0]
for i in R:
    j = N-i-1
    a = int(S[j][1])
    s = S[j][0]
    if s == 'C' and p[1] == a:
        b = p[0]-1
        if b<0:b=H-1
        p[0] = b
    elif s == 'R' and p[0] == a:
        b = p[1]-1
        if b<0:b=W-1
        p[1] = b
print('black' if (p[0]+p[1])%2 else 'white')
0