結果

問題 No.323 yuki国
ユーザー brthyyjpbrthyyjp
提出日時 2022-01-05 10:27:19
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,063 bytes
コンパイル時間 175 ms
コンパイル使用メモリ 82,304 KB
実行使用メモリ 109,580 KB
最終ジャッジ日時 2024-04-23 14:30:35
合計ジャッジ時間 13,554 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 44 ms
53,632 KB
testcase_01 AC 44 ms
54,016 KB
testcase_02 AC 44 ms
53,760 KB
testcase_03 AC 48 ms
54,784 KB
testcase_04 AC 47 ms
53,760 KB
testcase_05 AC 71 ms
70,784 KB
testcase_06 AC 65 ms
67,156 KB
testcase_07 AC 43 ms
53,760 KB
testcase_08 AC 734 ms
108,416 KB
testcase_09 WA -
testcase_10 AC 43 ms
54,016 KB
testcase_11 AC 57 ms
63,232 KB
testcase_12 AC 56 ms
63,616 KB
testcase_13 AC 748 ms
108,980 KB
testcase_14 AC 795 ms
109,312 KB
testcase_15 AC 664 ms
107,264 KB
testcase_16 WA -
testcase_17 AC 772 ms
108,456 KB
testcase_18 AC 104 ms
82,304 KB
testcase_19 AC 472 ms
96,000 KB
testcase_20 AC 148 ms
96,896 KB
testcase_21 AC 848 ms
109,568 KB
testcase_22 AC 331 ms
100,224 KB
testcase_23 AC 875 ms
109,580 KB
testcase_24 AC 185 ms
97,664 KB
testcase_25 AC 761 ms
108,416 KB
testcase_26 AC 185 ms
97,792 KB
testcase_27 AC 806 ms
108,800 KB
testcase_28 AC 808 ms
108,912 KB
testcase_29 AC 788 ms
108,800 KB
testcase_30 AC 46 ms
53,888 KB
testcase_31 AC 63 ms
66,256 KB
testcase_32 AC 66 ms
67,348 KB
testcase_33 AC 61 ms
64,768 KB
testcase_34 AC 72 ms
70,528 KB
testcase_35 AC 43 ms
53,796 KB
testcase_36 AC 70 ms
68,736 KB
testcase_37 AC 44 ms
53,760 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
import io, os
input = sys.stdin.readline

def main():

    h, w = map(int, input().split())
    a, si, sj = map(int, input().split())
    b, ti, tj = map(int, input().split())

    M = [str(input().rstrip()) for i in range(h)]

    visit = [[False]*1051 for i in range(h*w)]
    from collections import deque
    q = deque([])
    s = si*w+sj
    t = ti*w+tj
    q.append((s, a))
    visit[s][a] = True
    while q:
        v, x = q.popleft()
        if v == t and x == b:
            break
        i, j = divmod(v, w)
        for di, dj in (-1, 0), (1, 0), (0, 1), (0, -1):
            ni, nj = i+di, j+dj
            if 0 <= ni < h and 0 <= nj < w:
                nv = ni*w+nj
                if M[ni][nj] == '*':
                    nx = x+1
                else:
                    nx = x-1
                if nx >= 1 and nx <= 1050 and not visit[nv][nx]:
                    q.append((nv, nx))
                    visit[nv][nx] = True
    if visit[t][b]:
        print('Yes')
    else:
        print('No')

if __name__ == '__main__':
    main()
0