結果
問題 |
No.351 市松スライドパズル
|
ユーザー |
|
提出日時 | 2018-05-27 07:13:26 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 841 bytes |
コンパイル時間 | 253 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 119,720 KB |
最終ジャッジ日時 | 2024-06-28 18:21:56 |
合計ジャッジ時間 | 10,303 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 7 WA * 2 TLE * 8 |
ソースコード
def main(): H, W = map(int, input().split()) if H == W == 1: print('white') return N = int(input()) S = [(i, int(j)) for i, j in (input().split() for _ in [0] * N)] if W == 1: even = 0 odd = 1 else: n = W // 2 if W % 2: even = int('01' * n + '0', 2) odd = int('10' * n + '1', 2) else: even = int('01' * n, 2) odd = int('10' * n, 2) S.reverse() col, row = 0, 0 for n in S: if n == ('R', row): col -= 1 elif n == ('C', col): row -= 1 col = abs(col) % W row = abs(row) % H n = W - 1 - col if row % 2: i = odd & (2 ** n) else: i = even & (2 ** n) i = 1 if i else 0 color = ('white', 'black') print(color[i]) main()