結果

問題 No.351 市松スライドパズル
ユーザー GrayCoderGrayCoder
提出日時 2018-05-27 11:40:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 479 ms / 2,000 ms
コード長 589 bytes
コンパイル時間 94 ms
コンパイル使用メモリ 10,972 KB
実行使用メモリ 88,484 KB
最終ジャッジ日時 2023-09-11 03:53:52
合計ジャッジ時間 5,476 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
7,868 KB
testcase_01 AC 16 ms
7,792 KB
testcase_02 AC 17 ms
7,820 KB
testcase_03 AC 15 ms
7,892 KB
testcase_04 AC 16 ms
7,816 KB
testcase_05 AC 16 ms
7,884 KB
testcase_06 AC 16 ms
7,848 KB
testcase_07 AC 15 ms
7,944 KB
testcase_08 AC 16 ms
7,932 KB
testcase_09 AC 16 ms
7,856 KB
testcase_10 AC 16 ms
7,808 KB
testcase_11 AC 16 ms
7,852 KB
testcase_12 AC 16 ms
7,852 KB
testcase_13 AC 470 ms
85,812 KB
testcase_14 AC 472 ms
87,492 KB
testcase_15 AC 478 ms
87,228 KB
testcase_16 AC 479 ms
88,312 KB
testcase_17 AC 433 ms
87,460 KB
testcase_18 AC 432 ms
87,960 KB
testcase_19 AC 477 ms
87,148 KB
testcase_20 AC 476 ms
88,484 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys

def main():
    H, W = map(int, input().split())
    if H == W == 1:
        print('white')
        return
    N = int(input())
    S = sys.stdin.read().splitlines()

    wb = '01' * (W // 2 + 1)
    puzzle = int(wb[:W], 2)

    col, row = 0, 0
    for s in S[::-1]:
        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

    color = ('white', 'black')
    n = W - 1 - col
    i = bool(puzzle & (2 ** n))
    if row % 2:
        i = not i
    print(color[i])

main()
0