結果

問題 No.323 yuki国
ユーザー brthyyjpbrthyyjp
提出日時 2022-01-05 10:31:24
言語 PyPy3
(7.3.15)
結果
AC  
実行時間 1,703 ms / 5,000 ms
コード長 1,063 bytes
コンパイル時間 259 ms
コンパイル使用メモリ 82,560 KB
実行使用メモリ 140,672 KB
最終ジャッジ日時 2024-04-23 14:34:34
合計ジャッジ時間 20,231 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 41 ms
53,888 KB
testcase_01 AC 41 ms
53,760 KB
testcase_02 AC 42 ms
54,400 KB
testcase_03 AC 47 ms
55,424 KB
testcase_04 AC 43 ms
53,888 KB
testcase_05 AC 80 ms
76,288 KB
testcase_06 AC 65 ms
69,120 KB
testcase_07 AC 46 ms
54,144 KB
testcase_08 AC 1,573 ms
138,624 KB
testcase_09 AC 970 ms
128,640 KB
testcase_10 AC 42 ms
53,760 KB
testcase_11 AC 54 ms
63,360 KB
testcase_12 AC 54 ms
63,360 KB
testcase_13 AC 898 ms
127,616 KB
testcase_14 AC 1,601 ms
139,520 KB
testcase_15 AC 769 ms
125,952 KB
testcase_16 AC 1,545 ms
139,776 KB
testcase_17 AC 886 ms
127,360 KB
testcase_18 AC 101 ms
88,192 KB
testcase_19 AC 864 ms
114,688 KB
testcase_20 AC 172 ms
115,712 KB
testcase_21 AC 1,651 ms
140,672 KB
testcase_22 AC 375 ms
119,296 KB
testcase_23 AC 1,703 ms
139,520 KB
testcase_24 AC 206 ms
116,096 KB
testcase_25 AC 866 ms
127,104 KB
testcase_26 AC 210 ms
116,096 KB
testcase_27 AC 1,583 ms
139,136 KB
testcase_28 AC 945 ms
128,256 KB
testcase_29 AC 912 ms
128,000 KB
testcase_30 AC 40 ms
54,272 KB
testcase_31 AC 58 ms
66,560 KB
testcase_32 AC 61 ms
69,120 KB
testcase_33 AC 55 ms
65,920 KB
testcase_34 AC 70 ms
74,240 KB
testcase_35 AC 41 ms
53,888 KB
testcase_36 AC 67 ms
70,656 KB
testcase_37 AC 41 ms
54,144 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]*2001 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 <= 2000 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