結果

問題 No.351 市松スライドパズル
ユーザー aka_satana_haaka_satana_ha
提出日時 2017-11-28 16:27:16
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 894 bytes
コンパイル時間 140 ms
コンパイル使用メモリ 10,836 KB
実行使用メモリ 355,660 KB
最終ジャッジ日時 2023-08-18 09:14:11
合計ジャッジ時間 7,233 ms
ジャッジサーバーID
(参考情報)
judge14 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 AC 15 ms
7,796 KB
testcase_02 AC 16 ms
7,900 KB
testcase_03 AC 15 ms
7,832 KB
testcase_04 AC 15 ms
7,988 KB
testcase_05 AC 15 ms
7,944 KB
testcase_06 AC 16 ms
7,844 KB
testcase_07 AC 15 ms
7,848 KB
testcase_08 AC 15 ms
7,848 KB
testcase_09 AC 17 ms
7,952 KB
testcase_10 AC 17 ms
7,908 KB
testcase_11 AC 15 ms
7,852 KB
testcase_12 AC 16 ms
7,848 KB
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

H,W=[int(i) for i in input().split()]
N=int(input())
sousas=[]
for i in range(N):
    sousa=input().split()
    sousas.append(sousa)

#init
black=[[False for i in range(W)] for j in range(H)]
for i in range(H):
    offset=(i+1)%2
    for j in range(offset,W,2):
        black[i][j]=True

now_pos=[0,0]
for sousa in reversed(sousas):
    if sousa[0]=='R':
        row=int(sousa[1])
        if now_pos[0]==row:
            if now_pos[1]==0:
                now_pos=[now_pos[0],W-1]
            else:
                now_pos=[now_pos[0],now_pos[1]-1]
    else:
        col=int(sousa[1])
        if now_pos[1]==col:
            if now_pos[0]==0:
                now_pos=[H-1,now_pos[1]]
            else:
                now_pos=[now_pos[0]-1,now_pos[1]]
    # for i in range(H):
    #     print(black[i])
    # print('\n')
ans='black' if black[now_pos[0]][now_pos[1]]==True else 'white'
print(ans)
0