結果

問題 No.351 市松スライドパズル
ユーザー GrayCoderGrayCoder
提出日時 2018-05-27 08:37:43
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 876 bytes
コンパイル時間 88 ms
コンパイル使用メモリ 10,756 KB
実行使用メモリ 86,548 KB
最終ジャッジ日時 2023-09-11 03:50:20
合計ジャッジ時間 6,392 ms
ジャッジサーバーID
(参考情報)
judge13 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
7,872 KB
testcase_01 AC 17 ms
7,976 KB
testcase_02 AC 17 ms
7,972 KB
testcase_03 AC 16 ms
7,856 KB
testcase_04 AC 16 ms
7,852 KB
testcase_05 AC 16 ms
7,780 KB
testcase_06 AC 16 ms
7,800 KB
testcase_07 AC 16 ms
7,800 KB
testcase_08 AC 16 ms
7,772 KB
testcase_09 WA -
testcase_10 AC 16 ms
7,864 KB
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 552 ms
86,468 KB
testcase_16 AC 558 ms
86,548 KB
testcase_17 AC 518 ms
86,484 KB
testcase_18 AC 517 ms
86,468 KB
testcase_19 WA -
testcase_20 AC 555 ms
86,432 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.readlines()

    if W == 1:
        even = 0
        odd = 1
    else:
        n = W // 2
        if W % 2:
            even = int('01' * n + '0', 2)
            odd = int('10' * n + '1', 2)
        else:
            even = int('01' * n, 2)
            odd = int('10' * n, 2)

    col, row = 0, 0
    for n in S[::-1]:
        n = n.rstrip()
        if n == 'R ' + str(row):
            col += 1
        elif n == 'C ' + str(col):
            row += 1
    col = col % (W - 1) if W > 1 else col
    row = row % (H - 1) if H > 1 else row
    n = W - 1 - col
    if row % 2:
        i = odd & (2 ** n)
    else:
        i = even & (2 ** n)
    i = 1 if i else 0
    color = ('white', 'black')
    print(color[i])

main()
0