結果

問題 No.2646 Cycle Maze
ユーザー hato336hato336
提出日時 2024-02-25 20:39:03
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,207 bytes
コンパイル時間 174 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 246,616 KB
最終ジャッジ日時 2024-02-25 20:39:40
合計ジャッジ時間 30,700 ms
ジャッジサーバーID
(参考情報)
judge10 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 125 ms
84,952 KB
testcase_01 AC 124 ms
84,952 KB
testcase_02 AC 129 ms
84,952 KB
testcase_03 AC 123 ms
85,080 KB
testcase_04 AC 126 ms
84,952 KB
testcase_05 AC 123 ms
84,952 KB
testcase_06 WA -
testcase_07 AC 160 ms
88,280 KB
testcase_08 AC 124 ms
84,952 KB
testcase_09 AC 123 ms
84,952 KB
testcase_10 AC 138 ms
88,920 KB
testcase_11 AC 133 ms
88,280 KB
testcase_12 WA -
testcase_13 AC 123 ms
84,952 KB
testcase_14 AC 125 ms
84,952 KB
testcase_15 AC 124 ms
84,952 KB
testcase_16 WA -
testcase_17 AC 123 ms
84,952 KB
testcase_18 WA -
testcase_19 AC 126 ms
84,952 KB
testcase_20 AC 125 ms
84,952 KB
testcase_21 AC 124 ms
84,952 KB
testcase_22 AC 127 ms
85,080 KB
testcase_23 AC 125 ms
84,952 KB
testcase_24 AC 124 ms
84,952 KB
testcase_25 AC 2,191 ms
195,800 KB
testcase_26 AC 1,376 ms
158,040 KB
testcase_27 AC 1,410 ms
178,264 KB
testcase_28 AC 402 ms
101,976 KB
testcase_29 TLE -
testcase_30 AC 1,451 ms
158,040 KB
testcase_31 AC 963 ms
142,552 KB
testcase_32 AC 151 ms
89,048 KB
testcase_33 AC 208 ms
99,288 KB
testcase_34 AC 330 ms
113,240 KB
testcase_35 AC 1,205 ms
150,616 KB
testcase_36 AC 237 ms
99,928 KB
testcase_37 AC 461 ms
121,432 KB
testcase_38 AC 359 ms
97,752 KB
testcase_39 AC 1,476 ms
157,016 KB
testcase_40 AC 748 ms
117,848 KB
testcase_41 AC 1,188 ms
148,952 KB
testcase_42 AC 246 ms
94,168 KB
testcase_43 AC 249 ms
93,400 KB
testcase_44 AC 584 ms
108,504 KB
testcase_45 AC 1,670 ms
214,896 KB
testcase_46 AC 1,876 ms
246,616 KB
testcase_47 TLE -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
権限があれば一括ダウンロードができます

ソースコード

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(T+1)] 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()
    if t == T:
        continue
    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(T+1):
    ans = min(ans,dist[gx][gy][i])
print('Yes' if ans <= T else 'No')
0