結果

問題 No.2646 Cycle Maze
ユーザー hato336hato336
提出日時 2024-02-25 20:43:53
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,206 bytes
コンパイル時間 388 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 367,492 KB
最終ジャッジ日時 2024-02-25 20:44:30
合計ジャッジ時間 31,650 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 136 ms
91,756 KB
testcase_01 AC 138 ms
84,952 KB
testcase_02 AC 130 ms
84,952 KB
testcase_03 AC 129 ms
85,080 KB
testcase_04 AC 137 ms
84,952 KB
testcase_05 AC 133 ms
84,952 KB
testcase_06 AC 137 ms
84,952 KB
testcase_07 AC 149 ms
88,280 KB
testcase_08 AC 134 ms
84,952 KB
testcase_09 AC 135 ms
84,952 KB
testcase_10 AC 152 ms
88,920 KB
testcase_11 AC 139 ms
88,280 KB
testcase_12 AC 142 ms
84,952 KB
testcase_13 AC 131 ms
84,952 KB
testcase_14 AC 129 ms
84,952 KB
testcase_15 AC 130 ms
84,952 KB
testcase_16 AC 130 ms
84,952 KB
testcase_17 AC 130 ms
84,952 KB
testcase_18 AC 128 ms
84,952 KB
testcase_19 AC 131 ms
84,952 KB
testcase_20 AC 133 ms
84,952 KB
testcase_21 AC 159 ms
88,280 KB
testcase_22 AC 130 ms
85,080 KB
testcase_23 AC 129 ms
84,952 KB
testcase_24 AC 128 ms
84,952 KB
testcase_25 AC 2,275 ms
195,800 KB
testcase_26 AC 1,434 ms
158,040 KB
testcase_27 AC 1,585 ms
178,264 KB
testcase_28 AC 405 ms
101,976 KB
testcase_29 AC 2,384 ms
200,664 KB
testcase_30 AC 1,470 ms
158,040 KB
testcase_31 AC 966 ms
142,552 KB
testcase_32 AC 158 ms
89,048 KB
testcase_33 AC 231 ms
99,416 KB
testcase_34 AC 344 ms
113,240 KB
testcase_35 AC 1,215 ms
150,616 KB
testcase_36 AC 241 ms
99,928 KB
testcase_37 AC 441 ms
121,304 KB
testcase_38 AC 398 ms
97,752 KB
testcase_39 AC 1,449 ms
157,016 KB
testcase_40 AC 726 ms
117,848 KB
testcase_41 AC 1,294 ms
148,952 KB
testcase_42 AC 284 ms
94,168 KB
testcase_43 AC 274 ms
93,400 KB
testcase_44 AC 571 ms
108,504 KB
testcase_45 AC 2,039 ms
214,900 KB
testcase_46 AC 2,281 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