結果

問題 No.351 市松スライドパズル
ユーザー aka_satana_ha
提出日時 2017-11-28 16:12:24
言語 Python3
(3.13.1 + numpy 2.2.1 + scipy 1.14.1)
結果
TLE  
実行時間 -
コード長 788 bytes
コンパイル時間 311 ms
コンパイル使用メモリ 12,544 KB
実行使用メモリ 242,340 KB
最終ジャッジ日時 2024-11-27 13:10:45
合計ジャッジ時間 32,499 ms
ジャッジサーバーID
(参考情報)
judge2 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 8 TLE * 9
権限があれば一括ダウンロードができます

ソースコード

diff #

H,W=[int(i) for i in input().split()]
N=int(input())
sousas=[]
for i in range(N):
    sousa=input().split()
    sousas.append(sousa)

#init
black=[[False for i in range(W)] for j in range(H)]
for i in range(H):
    offset=(i+1)%2
    for j in range(offset,W,2):
        black[i][j]=True

for sousa in sousas:
    if sousa[0]=='R':
        row=int(sousa[1])
        tmp=black[row][W-1]
        for i in reversed(range(1,W)):
            black[row][i]=black[row][i-1]
        black[row][0]=tmp
    else:
        col=int(sousa[1])
        tmp=black[H-1][col]
        for i in reversed(range(1,H)):
            black[i][col]=black[i-1][col]
        black[0][col]=tmp
    # for i in range(H):
    #     print(black[i])
    # print('\n')
ans='black' if black[0][0]==True else 'white'
print(ans)
0