結果

問題 No.351 市松スライドパズル
ユーザー tookunn_1213tookunn_1213
提出日時 2016-03-12 00:52:22
言語 PyPy2
(7.3.15)
結果
AC  
実行時間 471 ms / 2,000 ms
コード長 433 bytes
コンパイル時間 592 ms
コンパイル使用メモリ 77,472 KB
実行使用メモリ 126,344 KB
最終ジャッジ日時 2023-10-25 07:24:23
合計ジャッジ時間 6,707 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 377 ms
94,668 KB
testcase_01 AC 68 ms
76,068 KB
testcase_02 AC 69 ms
76,068 KB
testcase_03 AC 70 ms
76,068 KB
testcase_04 AC 70 ms
76,068 KB
testcase_05 AC 67 ms
76,068 KB
testcase_06 AC 68 ms
76,068 KB
testcase_07 AC 68 ms
76,068 KB
testcase_08 AC 68 ms
76,068 KB
testcase_09 AC 70 ms
76,068 KB
testcase_10 AC 70 ms
76,068 KB
testcase_11 AC 69 ms
76,068 KB
testcase_12 AC 70 ms
76,068 KB
testcase_13 AC 459 ms
124,040 KB
testcase_14 AC 471 ms
125,672 KB
testcase_15 AC 451 ms
126,244 KB
testcase_16 AC 445 ms
126,264 KB
testcase_17 AC 448 ms
123,176 KB
testcase_18 AC 438 ms
121,336 KB
testcase_19 AC 445 ms
126,344 KB
testcase_20 AC 445 ms
126,244 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

H,W = map(int,raw_input().split())
N = int(raw_input())
S = ['' for i in range(N)]
K = [0 for i in range(N)]
for i in range(N):
	s,k = raw_input().split()
	k = int(k)
	S[i],K[i] = s,k
R = 0
C = 0
for i in range(N - 1,-1,-1):
	if S[i] == 'R':
		if K[i] == R:
			if C == 0:
				C = W - 1
			else:
				C -= 1
	else:
		if K[i] == C:
			if R == 0:
				R = H - 1
			else:
				R -= 1
if (R + C) % 2 == 0:
	print 'white'
else:
	print 'black'
0