結果

問題 No.351 市松スライドパズル
ユーザー GrayCoderGrayCoder
提出日時 2018-05-25 20:54:42
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 828 bytes
コンパイル時間 290 ms
コンパイル使用メモリ 86,980 KB
実行使用メモリ 260,616 KB
最終ジャッジ日時 2023-09-11 03:31:44
合計ジャッジ時間 10,433 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 70 ms
71,320 KB
testcase_01 AC 71 ms
71,192 KB
testcase_02 AC 73 ms
71,284 KB
testcase_03 AC 70 ms
71,408 KB
testcase_04 AC 71 ms
71,288 KB
testcase_05 AC 71 ms
71,200 KB
testcase_06 AC 71 ms
71,320 KB
testcase_07 AC 70 ms
71,120 KB
testcase_08 AC 70 ms
71,280 KB
testcase_09 RE -
testcase_10 RE -
testcase_11 AC 69 ms
71,304 KB
testcase_12 RE -
testcase_13 RE -
testcase_14 RE -
testcase_15 AC 822 ms
254,208 KB
testcase_16 RE -
testcase_17 RE -
testcase_18 AC 815 ms
254,112 KB
testcase_19 RE -
testcase_20 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

def main():
    H, W = map(int, input().split())
    if H == W == 1:
        print('white')
        return
    N = int(input())
    S = [(i, int(j)) for i, j in (input().split() for _ in [0] * N)]


    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)
    S.reverse()
    col, row = 0, 0
    for n in S:
        if n == ('R', row):
            col = col - 1 if col > 0 else W - 1
        elif n == ('C', col):
            row = row - 1 if row > 0 else H - 1
    n = W - 1 - col
    if row % 2:
        i = odd & (2 ** n)
    else:
        i = even & (2 ** n)
    color = ('white', 'black')
    print(color[i])

main()
0