結果

問題 No.2646 Cycle Maze
ユーザー hato336hato336
提出日時 2024-02-25 20:35:02
言語 PyPy3
(7.3.15)
結果
RE  
実行時間 -
コード長 1,175 bytes
コンパイル時間 293 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 233,880 KB
最終ジャッジ日時 2024-02-25 20:35:41
合計ジャッジ時間 28,626 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 123 ms
85,080 KB
testcase_01 AC 125 ms
84,952 KB
testcase_02 AC 139 ms
88,408 KB
testcase_03 AC 123 ms
84,952 KB
testcase_04 RE -
testcase_05 AC 149 ms
89,048 KB
testcase_06 RE -
testcase_07 RE -
testcase_08 AC 141 ms
84,952 KB
testcase_09 RE -
testcase_10 AC 152 ms
89,176 KB
testcase_11 AC 151 ms
89,176 KB
testcase_12 WA -
testcase_13 RE -
testcase_14 RE -
testcase_15 RE -
testcase_16 RE -
testcase_17 AC 139 ms
88,920 KB
testcase_18 WA -
testcase_19 AC 133 ms
88,408 KB
testcase_20 AC 134 ms
88,408 KB
testcase_21 RE -
testcase_22 AC 126 ms
85,080 KB
testcase_23 AC 127 ms
85,080 KB
testcase_24 AC 151 ms
88,408 KB
testcase_25 RE -
testcase_26 RE -
testcase_27 RE -
testcase_28 RE -
testcase_29 RE -
testcase_30 RE -
testcase_31 RE -
testcase_32 RE -
testcase_33 RE -
testcase_34 RE -
testcase_35 RE -
testcase_36 RE -
testcase_37 RE -
testcase_38 RE -
testcase_39 RE -
testcase_40 RE -
testcase_41 RE -
testcase_42 RE -
testcase_43 RE -
testcase_44 RE -
testcase_45 RE -
testcase_46 RE -
testcase_47 RE -
testcase_48 RE -
testcase_49 RE -
testcase_50 RE -
testcase_51 RE -
testcase_52 RE -
testcase_53 RE -
testcase_54 RE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import collections,sys,math,functools,operator,itertools,bisect,heapq,decimal,string,time,random
#sys.setrecursionlimit(10**9)
#sys.set_int_max_str_digits(0)
input = sys.stdin.readline
#n = int(input())
#alist = list(map(int,input().split()))
#alist = []
#s = input()
h,w,T = map(int,input().split())
#for i in range(n):
#    alist.append(list(map(int,input().split())))
sx,sy = map(lambda x:int(x)-1,input().split())
gx,gy = map(lambda x:int(x)-1,input().split())
grid = [list(map(int,list(input().rstrip()))) for i in range(h)]
start = (sx,sy,0)
d = collections.deque()
dist = [[[10**18 for i in range(210)] for j in range(w)] for feufr in range(h)]
d.append(start)
dist[sx][sy][0] = 0
dxy = [[-1,0],[1,0],[0,-1],[0,1],[0,0]]
while d:
    x,y,t = d.popleft()
    for dx,dy in dxy:
        if 0 <= x+dx < h and 0 <= y+dy < w:
            z = grid[x+dx][y+dy]
            zz = (z - (t + 1)) % (z + 1)
            if zz >= 1 and dist[x+dx][y+dy][t+1] > dist[x][y][t] + 1:
                dist[x+dx][y+dy][t+1] = dist[x][y][t] + 1
                d.append((x+dx,y+dy,t+1))
ans = 10**18
for i in range(210):
    ans = min(ans,dist[gx][gy][i])
print('Yes' if ans <= T else 'No')
0