結果

問題 No.351 市松スライドパズル
ユーザー H3PO4H3PO4
提出日時 2020-06-25 15:30:53
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 587 ms / 2,000 ms
コード長 421 bytes
コンパイル時間 291 ms
コンパイル使用メモリ 87,284 KB
実行使用メモリ 243,016 KB
最終ジャッジ日時 2023-09-16 22:42:03
合計ジャッジ時間 8,343 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 435 ms
177,448 KB
testcase_01 AC 76 ms
71,468 KB
testcase_02 AC 74 ms
71,564 KB
testcase_03 AC 76 ms
71,568 KB
testcase_04 AC 76 ms
71,448 KB
testcase_05 AC 76 ms
71,332 KB
testcase_06 AC 76 ms
71,144 KB
testcase_07 AC 76 ms
71,500 KB
testcase_08 AC 76 ms
71,152 KB
testcase_09 AC 76 ms
71,540 KB
testcase_10 AC 75 ms
71,372 KB
testcase_11 AC 76 ms
71,492 KB
testcase_12 AC 75 ms
71,352 KB
testcase_13 AC 566 ms
237,916 KB
testcase_14 AC 570 ms
238,080 KB
testcase_15 AC 580 ms
243,016 KB
testcase_16 AC 587 ms
242,856 KB
testcase_17 AC 564 ms
238,140 KB
testcase_18 AC 558 ms
234,480 KB
testcase_19 AC 573 ms
242,824 KB
testcase_20 AC 571 ms
242,864 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

input = sys.stdin.readline

H, W = map(int, input().split())
N = int(input())
Q = []
for _ in range(N):
    S, K = input().split()
    K = int(K)
    Q.append((S, K))

cur_x, cur_y = 0, 0
for s, k in reversed(Q):
    if s == 'R':
        if cur_x == k:
            cur_y = (cur_y - 1) % W
    else:
        if cur_y == k:
            cur_x = (cur_x - 1) % H
print('black' if (cur_x + cur_y) % 2 else 'white')
0