結果

問題 No.2646 Cycle Maze
ユーザー rlangevinrlangevin
提出日時 2024-02-26 12:28:15
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,073 bytes
コンパイル時間 256 ms
コンパイル使用メモリ 81,696 KB
実行使用メモリ 304,908 KB
最終ジャッジ日時 2024-02-26 12:28:35
合計ジャッジ時間 19,881 ms
ジャッジサーバーID
(参考情報)
judge15 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 42 ms
55,728 KB
testcase_01 AC 41 ms
55,728 KB
testcase_02 AC 42 ms
55,728 KB
testcase_03 AC 42 ms
55,728 KB
testcase_04 AC 42 ms
55,728 KB
testcase_05 AC 41 ms
55,728 KB
testcase_06 WA -
testcase_07 AC 44 ms
55,728 KB
testcase_08 AC 42 ms
55,728 KB
testcase_09 AC 42 ms
55,728 KB
testcase_10 AC 44 ms
55,856 KB
testcase_11 AC 44 ms
55,856 KB
testcase_12 WA -
testcase_13 AC 43 ms
55,728 KB
testcase_14 AC 42 ms
55,728 KB
testcase_15 AC 42 ms
55,728 KB
testcase_16 WA -
testcase_17 AC 42 ms
55,728 KB
testcase_18 WA -
testcase_19 AC 43 ms
55,856 KB
testcase_20 AC 42 ms
55,856 KB
testcase_21 AC 43 ms
55,856 KB
testcase_22 AC 43 ms
55,728 KB
testcase_23 AC 43 ms
55,728 KB
testcase_24 AC 43 ms
55,728 KB
testcase_25 AC 97 ms
123,876 KB
testcase_26 AC 128 ms
126,356 KB
testcase_27 AC 303 ms
176,400 KB
testcase_28 AC 88 ms
90,492 KB
testcase_29 AC 94 ms
124,832 KB
testcase_30 AC 103 ms
115,936 KB
testcase_31 AC 65 ms
126,112 KB
testcase_32 AC 59 ms
70,104 KB
testcase_33 AC 113 ms
145,432 KB
testcase_34 AC 206 ms
178,468 KB
testcase_35 AC 175 ms
131,460 KB
testcase_36 AC 140 ms
140,152 KB
testcase_37 AC 135 ms
192,540 KB
testcase_38 AC 68 ms
78,164 KB
testcase_39 AC 121 ms
115,296 KB
testcase_40 AC 56 ms
88,420 KB
testcase_41 AC 136 ms
128,532 KB
testcase_42 AC 97 ms
88,688 KB
testcase_43 AC 73 ms
77,268 KB
testcase_44 AC 109 ms
88,932 KB
testcase_45 AC 720 ms
276,996 KB
testcase_46 AC 587 ms
276,808 KB
testcase_47 AC 121 ms
257,668 KB
testcase_48 AC 394 ms
270,540 KB
testcase_49 AC 488 ms
273,736 KB
testcase_50 AC 1,265 ms
293,064 KB
testcase_51 TLE -
testcase_52 TLE -
testcase_53 TLE -
testcase_54 TLE -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline
from collections import *
M = 605

def f(h, w, t):
    return h * W * M + w * M + t

def g(v):
    t = v % M
    v //= M
    h, w = divmod(v, W)
    return h, w, t

H, W, T = map(int, input().split())
sx, sy = map(int, input().split())
gx, gy = map(int, input().split())
sx, sy, gx, gy = sx - 1, sy - 1, gx - 1, gy - 1
A = []
for i in range(H):
    L = list(input().rstrip())
    L = list(map(int, L))
    A.append(L)
    
seen = [0] * H * W * (M+5)
Q = deque()
Q.append(f(sx, sy, 0))
seen[f(sx, sy, 0)] = 1
dx = [1, 0, -1, 0, 0]
dy = [0, 1, 0, -1, 0]
while Q:
    v = Q.popleft()
    h, w, t = g(v)
    if t == T+1:
        break
    if h == gx and w == gy:
        print("Yes")
        exit()
        
    for k in range(5):
        x = h + dx[k]
        y = w + dy[k]
        if x < 0 or x > H - 1 or y < 0 or y > W - 1:
            continue
        b = (A[x][y] - t - 1) % (A[x][y] + 1)
        if b == 0 or seen[f(x, y, t+1)]:
            continue
        seen[f(x, y, t+1)] = 1
        Q.append(f(x, y, t+1))
    
print("No")    
0