結果

問題 No.351 市松スライドパズル
ユーザー ebicochinealebicochineal
提出日時 2016-03-12 13:27:23
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 330 ms / 2,000 ms
コード長 342 bytes
コンパイル時間 239 ms
コンパイル使用メモリ 77,480 KB
実行使用メモリ 94,840 KB
最終ジャッジ日時 2023-10-25 07:35:55
合計ジャッジ時間 5,620 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 318 ms
94,612 KB
testcase_01 AC 72 ms
76,056 KB
testcase_02 AC 73 ms
76,056 KB
testcase_03 AC 73 ms
76,056 KB
testcase_04 AC 72 ms
76,056 KB
testcase_05 AC 72 ms
76,056 KB
testcase_06 AC 73 ms
76,056 KB
testcase_07 AC 73 ms
76,056 KB
testcase_08 AC 71 ms
76,056 KB
testcase_09 AC 71 ms
76,056 KB
testcase_10 AC 73 ms
76,056 KB
testcase_11 AC 74 ms
76,056 KB
testcase_12 AC 74 ms
76,056 KB
testcase_13 AC 325 ms
94,356 KB
testcase_14 AC 324 ms
94,452 KB
testcase_15 AC 326 ms
94,840 KB
testcase_16 AC 329 ms
94,724 KB
testcase_17 AC 322 ms
94,612 KB
testcase_18 AC 324 ms
94,612 KB
testcase_19 AC 330 ms
94,692 KB
testcase_20 AC 327 ms
94,712 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

H, W = map(int, raw_input().split())
N = input()
S = [0]*N
K = [0]*N
for i in range(N):
    s = raw_input()
    S[i] = ord(s[0])-67
    K[i] = int(s[2:])
_H, _W = H-1, W-1
y = x = 0
for i in range(N-1, -1, -1):
    if S[i]:
        if K[i] == y: x = (x+_W)%W
    else:
        if K[i] == x: y = (y+_H)%H
print('black' if (y+x)%2 else 'white')
0