結果
| 問題 | 
                            No.351 市松スライドパズル
                             | 
                    
| コンテスト | |
| ユーザー | 
                             aka_satana_ha
                         | 
                    
| 提出日時 | 2017-11-28 16:27:16 | 
| 言語 | Python3  (3.13.1 + numpy 2.2.1 + scipy 1.14.1)  | 
                    
| 結果 | 
                             
                                TLE
                                 
                             
                            
                         | 
                    
| 実行時間 | - | 
| コード長 | 894 bytes | 
| コンパイル時間 | 282 ms | 
| コンパイル使用メモリ | 12,800 KB | 
| 実行使用メモリ | 246,784 KB | 
| 最終ジャッジ日時 | 2024-11-27 13:11:17 | 
| 合計ジャッジ時間 | 32,271 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge3 / judge5 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 8 TLE * 9 | 
ソースコード
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
now_pos=[0,0]
for sousa in reversed(sousas):
    if sousa[0]=='R':
        row=int(sousa[1])
        if now_pos[0]==row:
            if now_pos[1]==0:
                now_pos=[now_pos[0],W-1]
            else:
                now_pos=[now_pos[0],now_pos[1]-1]
    else:
        col=int(sousa[1])
        if now_pos[1]==col:
            if now_pos[0]==0:
                now_pos=[H-1,now_pos[1]]
            else:
                now_pos=[now_pos[0]-1,now_pos[1]]
    # for i in range(H):
    #     print(black[i])
    # print('\n')
ans='black' if black[now_pos[0]][now_pos[1]]==True else 'white'
print(ans)
            
            
            
        
            
aka_satana_ha