結果

問題 No.351 市松スライドパズル
ユーザー GrayCoderGrayCoder
提出日時 2018-05-27 12:01:04
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 483 ms / 2,000 ms
コード長 537 bytes
コンパイル時間 239 ms
コンパイル使用メモリ 10,748 KB
実行使用メモリ 88,312 KB
最終ジャッジ日時 2023-09-11 03:54:10
合計ジャッジ時間 5,779 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,792 KB
testcase_01 AC 17 ms
7,852 KB
testcase_02 AC 15 ms
7,840 KB
testcase_03 AC 16 ms
7,844 KB
testcase_04 AC 16 ms
7,808 KB
testcase_05 AC 16 ms
7,920 KB
testcase_06 AC 16 ms
7,772 KB
testcase_07 AC 16 ms
7,904 KB
testcase_08 AC 16 ms
7,772 KB
testcase_09 AC 16 ms
7,804 KB
testcase_10 AC 15 ms
7,796 KB
testcase_11 AC 16 ms
7,800 KB
testcase_12 AC 16 ms
7,852 KB
testcase_13 AC 478 ms
85,364 KB
testcase_14 AC 477 ms
86,104 KB
testcase_15 AC 481 ms
87,300 KB
testcase_16 AC 483 ms
87,108 KB
testcase_17 AC 437 ms
87,780 KB
testcase_18 AC 435 ms
87,156 KB
testcase_19 AC 478 ms
87,300 KB
testcase_20 AC 481 ms
88,312 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()

    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

    puzzle = '01' * (W // 2 + 1)
    color = ('white', 'black')
    i = int(puzzle[col])
    if row % 2:
        i = not i
    print(color[i])

main()
0