結果

問題 No.351 市松スライドパズル
ユーザー HachimoriHachimori
提出日時 2016-03-11 23:10:28
言語 Python2
(2.7.18)
結果
TLE  
(最新)
AC  
(最初)
実行時間 -
コード長 583 bytes
コンパイル時間 850 ms
コンパイル使用メモリ 7,052 KB
実行使用メモリ 149,272 KB
最終ジャッジ日時 2023-10-25 05:52:16
合計ジャッジ時間 23,089 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 AC 12 ms
6,404 KB
testcase_02 AC 11 ms
6,404 KB
testcase_03 AC 11 ms
6,404 KB
testcase_04 AC 12 ms
6,404 KB
testcase_05 AC 12 ms
6,404 KB
testcase_06 AC 11 ms
6,404 KB
testcase_07 AC 12 ms
6,404 KB
testcase_08 AC 11 ms
6,404 KB
testcase_09 AC 12 ms
6,404 KB
testcase_10 AC 12 ms
6,404 KB
testcase_11 AC 12 ms
6,404 KB
testcase_12 AC 11 ms
6,404 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 TLE -
testcase_17 TLE -
testcase_18 TLE -
testcase_19 TLE -
testcase_20 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

#!/usr/bin/env python
#coding:utf8


def read():
    row, col = map(int, raw_input().split())
    rcIdxList = []
    for i in range(input()):
        rc, idx = raw_input().split()
        rcIdxList.append((rc, int(idx)))
    return row, col, rcIdxList


def work((row, col, rcIdxList)):
    r, c = 0, 0
    for (rc, idx) in rcIdxList[::-1]:
        if rc == "R" and r == idx:
            c = (c + col - 1) % col
        elif rc == "C" and c == idx:
            r = (r + row - 1) % row

    print "white" if (r + c) % 2 == 0 else "black"


if __name__ == "__main__":
    work(read())
0