結果

問題 No.2646 Cycle Maze
ユーザー rlangevinrlangevin
提出日時 2024-02-26 12:24:45
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 1,073 bytes
コンパイル時間 3,036 ms
コンパイル使用メモリ 81,444 KB
実行使用メモリ 303,528 KB
最終ジャッジ日時 2024-02-26 12:25:07
合計ジャッジ時間 19,227 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
55,600 KB
testcase_01 AC 40 ms
55,600 KB
testcase_02 AC 41 ms
55,600 KB
testcase_03 AC 39 ms
55,600 KB
testcase_04 AC 40 ms
55,600 KB
testcase_05 AC 40 ms
55,600 KB
testcase_06 WA -
testcase_07 AC 40 ms
55,600 KB
testcase_08 AC 39 ms
55,600 KB
testcase_09 AC 41 ms
55,600 KB
testcase_10 AC 40 ms
55,728 KB
testcase_11 AC 42 ms
55,728 KB
testcase_12 WA -
testcase_13 AC 40 ms
55,600 KB
testcase_14 AC 40 ms
55,600 KB
testcase_15 AC 39 ms
55,600 KB
testcase_16 WA -
testcase_17 AC 42 ms
55,600 KB
testcase_18 WA -
testcase_19 AC 42 ms
55,728 KB
testcase_20 AC 41 ms
55,728 KB
testcase_21 AC 41 ms
55,728 KB
testcase_22 AC 39 ms
55,600 KB
testcase_23 AC 40 ms
55,600 KB
testcase_24 AC 40 ms
55,600 KB
testcase_25 AC 91 ms
123,420 KB
testcase_26 AC 121 ms
125,900 KB
testcase_27 AC 262 ms
175,636 KB
testcase_28 AC 84 ms
90,252 KB
testcase_29 AC 85 ms
124,364 KB
testcase_30 AC 98 ms
115,548 KB
testcase_31 AC 64 ms
125,704 KB
testcase_32 AC 58 ms
69,952 KB
testcase_33 AC 109 ms
144,852 KB
testcase_34 AC 199 ms
177,800 KB
testcase_35 AC 169 ms
130,968 KB
testcase_36 AC 128 ms
139,608 KB
testcase_37 AC 116 ms
191,652 KB
testcase_38 AC 63 ms
77,976 KB
testcase_39 AC 113 ms
114,908 KB
testcase_40 AC 53 ms
88,244 KB
testcase_41 AC 128 ms
128,060 KB
testcase_42 AC 94 ms
88,476 KB
testcase_43 AC 82 ms
77,096 KB
testcase_44 AC 97 ms
88,720 KB
testcase_45 AC 573 ms
275,552 KB
testcase_46 AC 571 ms
275,428 KB
testcase_47 AC 113 ms
256,284 KB
testcase_48 AC 357 ms
269,160 KB
testcase_49 AC 460 ms
272,356 KB
testcase_50 AC 1,172 ms
291,684 KB
testcase_51 AC 2,430 ms
303,060 KB
testcase_52 AC 2,480 ms
302,896 KB
testcase_53 AC 2,456 ms
302,832 KB
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+1)
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 h == gx and w == gy:
        print("Yes")
        exit()
    if t == T+1:
        break
        
    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