結果

問題 No.351 市松スライドパズル
ユーザー fumofumofuni
提出日時 2021-09-14 20:18:47
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 705 ms / 2,000 ms
コード長 436 bytes
コンパイル時間 468 ms
コンパイル使用メモリ 82,176 KB
実行使用メモリ 240,116 KB
最終ジャッジ日時 2024-06-27 11:14:06
合計ジャッジ時間 8,720 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 17
権限があれば一括ダウンロードができます

ソースコード

diff #

H,W=map(int,input().split())
N=int(input())
A=[]
B=[]
for i in range(N):
    x,y=input().split()
    A.append(x)
    B.append(int(y))
list.reverse(A)
list.reverse(B)
x=0
y=0
for i in range(N):
    if A[i]=='R':
        if B[i]==x:
            y-=1
            if y<0:
                y=W-1
    else:
        if B[i]==y:
            x-=1
            if x<0:
                x=H-1
if (x+y)%2:
    print('black')
else :
    print('white')
0