結果

問題 No.323 yuki国
ユーザー fumofumofunifumofumofuni
提出日時 2021-09-16 02:12:01
言語 PyPy3
(7.3.13)
結果
AC  
実行時間 555 ms / 5,000 ms
コード長 845 bytes
コンパイル時間 1,993 ms
コンパイル使用メモリ 87,080 KB
実行使用メモリ 123,620 KB
最終ジャッジ日時 2023-09-11 12:39:05
合計ジャッジ時間 12,932 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 103 ms
100,704 KB
testcase_01 AC 118 ms
107,224 KB
testcase_02 AC 103 ms
101,036 KB
testcase_03 AC 132 ms
107,204 KB
testcase_04 AC 118 ms
107,236 KB
testcase_05 AC 124 ms
107,256 KB
testcase_06 AC 120 ms
107,112 KB
testcase_07 AC 102 ms
100,812 KB
testcase_08 AC 407 ms
120,768 KB
testcase_09 AC 410 ms
120,368 KB
testcase_10 AC 101 ms
100,848 KB
testcase_11 AC 112 ms
106,820 KB
testcase_12 AC 112 ms
107,136 KB
testcase_13 AC 425 ms
123,516 KB
testcase_14 AC 425 ms
123,468 KB
testcase_15 AC 332 ms
117,804 KB
testcase_16 AC 428 ms
123,620 KB
testcase_17 AC 457 ms
123,540 KB
testcase_18 AC 224 ms
111,572 KB
testcase_19 AC 339 ms
117,356 KB
testcase_20 AC 525 ms
123,428 KB
testcase_21 AC 548 ms
123,496 KB
testcase_22 AC 555 ms
123,508 KB
testcase_23 AC 524 ms
123,424 KB
testcase_24 AC 357 ms
117,476 KB
testcase_25 AC 344 ms
117,384 KB
testcase_26 AC 461 ms
123,516 KB
testcase_27 AC 475 ms
123,548 KB
testcase_28 AC 470 ms
123,552 KB
testcase_29 AC 461 ms
123,492 KB
testcase_30 AC 104 ms
101,140 KB
testcase_31 AC 119 ms
106,792 KB
testcase_32 AC 122 ms
107,236 KB
testcase_33 AC 115 ms
107,312 KB
testcase_34 AC 122 ms
106,940 KB
testcase_35 AC 103 ms
101,008 KB
testcase_36 AC 122 ms
107,312 KB
testcase_37 AC 120 ms
107,164 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
H,W=map(int,input().split())
A,sx,sy=map(int,input().split())
B,gx,gy=map(int,input().split())
g=['']*H
for i in range(H):
    g[i]=input()
dist=[-1]*50*50*1500
dist[sx*50*1500+sy*1500+A]=0
que=deque([sx*50*1500+sy*1500+A])
dx=[1,0,-1,0]
dy=[0,1,0,-1]
while que:
    now=que.popleft()
    sz=now%1500
    now//=1500
    y=now%50
    now//=50
    x=now
    for i in range(4):
        nx=x+dx[i]
        ny=y+dy[i]
        if nx<0 or ny<0 or nx>=H or ny>=W:
            continue
        nt=sz
        if g[nx][ny]=='*':
            nt+=1
        else:
            nt-=1
        if nt>=1500 or nt<1:
            continue
        to=nx*50*1500+ny*1500+nt
        if dist[to]!=-1:
            continue
        dist[to]=0
        que.append(to)
if dist[gx*50*1500+gy*1500+B]==0:
    print('Yes')
else:
    print('No')



0