結果

問題 No.2646 Cycle Maze
ユーザー hato336hato336
提出日時 2024-02-25 20:36:42
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,193 bytes
コンパイル時間 257 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 287,732 KB
最終ジャッジ日時 2024-02-25 20:37:12
合計ジャッジ時間 26,630 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 126 ms
91,884 KB
testcase_01 AC 124 ms
84,952 KB
testcase_02 AC 140 ms
88,408 KB
testcase_03 AC 126 ms
84,952 KB
testcase_04 AC 156 ms
89,176 KB
testcase_05 AC 155 ms
89,048 KB
testcase_06 WA -
testcase_07 AC 162 ms
89,304 KB
testcase_08 AC 127 ms
84,952 KB
testcase_09 AC 158 ms
89,176 KB
testcase_10 AC 156 ms
89,176 KB
testcase_11 AC 156 ms
89,176 KB
testcase_12 WA -
testcase_13 AC 145 ms
89,048 KB
testcase_14 AC 146 ms
89,048 KB
testcase_15 AC 148 ms
89,048 KB
testcase_16 WA -
testcase_17 AC 143 ms
88,920 KB
testcase_18 WA -
testcase_19 AC 137 ms
88,408 KB
testcase_20 AC 138 ms
88,408 KB
testcase_21 AC 160 ms
89,176 KB
testcase_22 AC 128 ms
85,080 KB
testcase_23 AC 128 ms
85,080 KB
testcase_24 AC 136 ms
88,408 KB
testcase_25 AC 979 ms
129,112 KB
testcase_26 AC 916 ms
128,088 KB
testcase_27 AC 1,756 ms
177,496 KB
testcase_28 AC 401 ms
100,056 KB
testcase_29 AC 1,026 ms
131,540 KB
testcase_30 AC 743 ms
119,212 KB
testcase_31 AC 1,124 ms
140,120 KB
testcase_32 AC 214 ms
90,968 KB
testcase_33 AC 1,230 ms
145,880 KB
testcase_34 AC 1,763 ms
182,744 KB
testcase_35 AC 1,017 ms
132,824 KB
testcase_36 AC 1,137 ms
142,424 KB
testcase_37 AC 2,014 ms
198,744 KB
testcase_38 AC 290 ms
94,040 KB
testcase_39 AC 784 ms
119,000 KB
testcase_40 AC 576 ms
107,864 KB
testcase_41 AC 959 ms
131,064 KB
testcase_42 AC 354 ms
96,728 KB
testcase_43 AC 253 ms
91,736 KB
testcase_44 AC 334 ms
97,112 KB
testcase_45 TLE -
testcase_46 -- -
testcase_47 -- -
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(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)%210] > dist[x][y][t] + 1:
                dist[x+dx][y+dy][(t+1)%210] = dist[x][y][t] + 1
                d.append((x+dx,y+dy,(t+1)%210))
ans = 10**18
for i in range(210):
    ans = min(ans,dist[gx][gy][i])
print('Yes' if ans <= T else 'No')
0