結果
| 問題 | 
                            No.351 市松スライドパズル
                             | 
                    
| コンテスト | |
| ユーザー | 
                             | 
                    
| 提出日時 | 2016-03-11 22:39:36 | 
| 言語 | PyPy3  (7.3.15)  | 
                    
| 結果 | 
                             
                                AC
                                 
                             
                            
                         | 
                    
| 実行時間 | 795 ms / 2,000 ms | 
| コード長 | 357 bytes | 
| コンパイル時間 | 313 ms | 
| コンパイル使用メモリ | 81,904 KB | 
| 実行使用メモリ | 185,660 KB | 
| 最終ジャッジ日時 | 2024-09-25 01:01:44 | 
| 合計ジャッジ時間 | 9,699 ms | 
| 
                            ジャッジサーバーID (参考情報)  | 
                        judge5 / judge4 | 
(要ログイン)
| ファイルパターン | 結果 | 
|---|---|
| sample | AC * 4 | 
| other | AC * 17 | 
ソースコード
#!/usr/bin/env python3
h, w = map(int,input().split())
n = int(input())
ops = [(lambda s, k: (s, int(k)))(*input().split()) for i in range(n)]
y, x = 0, 0
for s, k in reversed(ops):
    if s == 'R':
        if y == k:
            x = (x - 1) % w
    elif s == 'C':
        if x == k:
            y = (y - 1) % h
print(y % 2 == x % 2 and 'white' or 'black')