結果

問題 No.351 市松スライドパズル
ユーザー FromBooskaFromBooska
提出日時 2023-10-17 16:04:41
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,179 ms / 2,000 ms
コード長 607 bytes
コンパイル時間 1,698 ms
コンパイル使用メモリ 81,452 KB
実行使用メモリ 298,240 KB
最終ジャッジ日時 2023-10-17 16:04:58
合計ジャッジ時間 12,897 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 782 ms
244,112 KB
testcase_01 AC 32 ms
53,448 KB
testcase_02 AC 33 ms
53,448 KB
testcase_03 AC 33 ms
53,448 KB
testcase_04 AC 35 ms
53,448 KB
testcase_05 AC 35 ms
53,448 KB
testcase_06 AC 35 ms
53,448 KB
testcase_07 AC 36 ms
53,448 KB
testcase_08 AC 35 ms
53,448 KB
testcase_09 AC 35 ms
53,448 KB
testcase_10 AC 33 ms
53,448 KB
testcase_11 AC 35 ms
53,448 KB
testcase_12 AC 35 ms
53,448 KB
testcase_13 AC 1,001 ms
292,152 KB
testcase_14 AC 1,179 ms
292,252 KB
testcase_15 AC 968 ms
292,440 KB
testcase_16 AC 970 ms
292,252 KB
testcase_17 AC 937 ms
286,852 KB
testcase_18 AC 941 ms
298,240 KB
testcase_19 AC 949 ms
292,448 KB
testcase_20 AC 955 ms
292,448 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

# ゴールから逆順に[0,0]がどこに移っていくか見ればいい

H, W = map(int, input().split())
N = int(input())
SK = []
for i in range(N):
    s, k = map(str, input().split())
    k = int(k)
    SK.append([s, k])
SK = SK[::-1]
#print(SK)

current_r, current_c = 0, 0
for i in range(N):
    s, k = SK[i]
    if s == 'R':
        if current_r == k:
            current_c = (current_c-1)%W
    elif s == 'C':
        if current_c == k:
            current_r = (current_r-1)%H
    #print(current_r, current_c)
        
if (current_r+current_c)%2 == 0:
    print('white')
else:
    print('black')
0