結果
問題 | No.351 市松スライドパズル |
ユーザー |
![]() |
提出日時 | 2023-02-28 21:58:43 |
言語 | PyPy3 (7.3.15) |
結果 |
AC
|
実行時間 | 894 ms / 2,000 ms |
コード長 | 697 bytes |
コンパイル時間 | 285 ms |
コンパイル使用メモリ | 81,664 KB |
実行使用メモリ | 247,272 KB |
最終ジャッジ日時 | 2024-09-15 23:54:44 |
合計ジャッジ時間 | 10,799 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 17 |
ソースコード
# 愚直シミュレーションは間に合わない # 公式解説より # 全盤面をシミュレートするのは間に合わない # (0, 0)を戻していってどこにあったのかを調べる H, W = map(int, input().split()) query = [] N = int(input()) for i in range(N): s, k = map(str, input().split()) query.append((s, int(k))) #print(query) current = (0, 0) for i in range(N): h, w = current s, k = query[-1-i] if s == 'R': if k == h: current = (h, (w-1)%W) elif s == 'C': if k == w: current = ((h-1)%H, w) #print(s, k, current) h, w = current if (h+w)%2 == 0: print('white') else: print('black')