結果

問題 No.351 市松スライドパズル
ユーザー H3PO4H3PO4
提出日時 2020-06-25 15:30:45
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,039 ms / 2,000 ms
コード長 421 bytes
コンパイル時間 86 ms
コンパイル使用メモリ 10,716 KB
実行使用メモリ 109,428 KB
最終ジャッジ日時 2023-09-16 22:41:46
合計ジャッジ時間 12,052 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,013 ms
78,792 KB
testcase_01 AC 16 ms
7,848 KB
testcase_02 AC 16 ms
7,848 KB
testcase_03 AC 16 ms
7,988 KB
testcase_04 AC 16 ms
7,844 KB
testcase_05 AC 16 ms
7,776 KB
testcase_06 AC 16 ms
7,820 KB
testcase_07 AC 16 ms
7,784 KB
testcase_08 AC 16 ms
7,868 KB
testcase_09 AC 16 ms
7,948 KB
testcase_10 AC 16 ms
7,864 KB
testcase_11 AC 16 ms
7,816 KB
testcase_12 AC 16 ms
7,788 KB
testcase_13 AC 1,011 ms
106,900 KB
testcase_14 AC 1,016 ms
107,736 KB
testcase_15 AC 1,023 ms
109,428 KB
testcase_16 AC 1,039 ms
109,256 KB
testcase_17 AC 1,008 ms
109,360 KB
testcase_18 AC 997 ms
109,248 KB
testcase_19 AC 1,036 ms
109,408 KB
testcase_20 AC 1,030 ms
109,300 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