結果
問題 |
No.351 市松スライドパズル
|
ユーザー |
|
提出日時 | 2018-05-27 10:24:01 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
AC
|
実行時間 | 659 ms / 2,000 ms |
コード長 | 657 bytes |
コンパイル時間 | 76 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 73,464 KB |
最終ジャッジ日時 | 2024-06-28 18:25:03 |
合計ジャッジ時間 | 6,811 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 17 |
ソースコード
import sys def main(): H, W = map(int, input().split()) if H == W == 1: print('white') return N = int(input()) S = sys.stdin.readlines() wb = '01' * (W // 2 + 2) even = int(wb[:W], 2) odd = int(wb[1:W+1], 2) col, row = 0, 0 for s in S[::-1]: s = s.rstrip() if s == 'R ' + str(row): col = col - 1 if col > 0 else W - 1 elif s == 'C ' + str(col): row = row - 1 if row > 0 else H - 1 n = W - 1 - col color = ('white', 'black') if row % 2: i = bool(odd & (2 ** n)) else: i = bool(even & (2 ** n)) print(color[i]) main()