結果

問題 No.2646 Cycle Maze
ユーザー nikoro256nikoro256
提出日時 2024-02-25 18:40:58
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 999 bytes
コンパイル時間 363 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 161,312 KB
最終ジャッジ日時 2024-02-25 18:41:18
合計ジャッジ時間 20,060 ms
ジャッジサーバーID
(参考情報)
judge13 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
55,604 KB
testcase_01 AC 39 ms
55,604 KB
testcase_02 AC 40 ms
55,604 KB
testcase_03 AC 47 ms
64,036 KB
testcase_04 AC 39 ms
55,608 KB
testcase_05 AC 40 ms
55,604 KB
testcase_06 AC 39 ms
55,604 KB
testcase_07 AC 40 ms
55,604 KB
testcase_08 WA -
testcase_09 AC 40 ms
55,604 KB
testcase_10 AC 44 ms
61,528 KB
testcase_11 WA -
testcase_12 AC 40 ms
55,604 KB
testcase_13 WA -
testcase_14 AC 38 ms
55,604 KB
testcase_15 AC 38 ms
55,604 KB
testcase_16 WA -
testcase_17 AC 38 ms
55,604 KB
testcase_18 WA -
testcase_19 AC 40 ms
55,604 KB
testcase_20 AC 41 ms
55,604 KB
testcase_21 AC 39 ms
55,604 KB
testcase_22 AC 43 ms
61,576 KB
testcase_23 AC 40 ms
55,604 KB
testcase_24 AC 40 ms
55,608 KB
testcase_25 AC 1,307 ms
127,136 KB
testcase_26 AC 868 ms
112,928 KB
testcase_27 AC 909 ms
121,760 KB
testcase_28 AC 233 ms
84,292 KB
testcase_29 AC 1,374 ms
132,384 KB
testcase_30 AC 923 ms
112,928 KB
testcase_31 AC 600 ms
106,272 KB
testcase_32 AC 61 ms
70,544 KB
testcase_33 AC 121 ms
85,664 KB
testcase_34 AC 220 ms
95,136 KB
testcase_35 AC 728 ms
108,064 KB
testcase_36 AC 136 ms
85,152 KB
testcase_37 AC 299 ms
101,536 KB
testcase_38 AC 215 ms
82,388 KB
testcase_39 AC 935 ms
112,416 KB
testcase_40 AC 479 ms
94,752 KB
testcase_41 AC 741 ms
107,552 KB
testcase_42 AC 148 ms
81,644 KB
testcase_43 AC 144 ms
79,664 KB
testcase_44 AC 379 ms
91,168 KB
testcase_45 AC 985 ms
140,704 KB
testcase_46 AC 1,209 ms
161,312 KB
testcase_47 TLE -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
testcase_53 -- -
testcase_54 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
def bfs(s):
    dq=deque()
    dq.append([s,0])
    high=[10**9 for _ in range(N)]
    high[s]=0
    while len(dq)!=0:
        p,h=dq.popleft()
        for e in edge[p]:
            if  high[e]==10**9:
                dq.append([e,h+1])
                high[e]=h+1
    return high

H,W,T=map(int,input().split())
Sy,Sx=map(int,input().split())
Gy,Gx=map(int,input().split())
A=[]
for _ in range(H):
    tmp=input()
    A.append([int(tmp[i]) for i in range(W)])
dp=[[[False]*W for _ in range(H)] for _ in range(T)]
dp[0][Sy-1][Sx-1]=True
for i in range(T-1):
    for j in range(H):
        for k in range(W):
            if dp[i][j][k]==True:
                for d1,d2 in [[1,0],[0,1],[-1,0],[0,-1],[0,0]]:
                    x=j+d1
                    y=k+d2
                    if 0<=x<H and 0<=y<W and (A[x][y]-i)%(A[x][y]+1)!=0:
                        dp[i+1][x][y]=True
for i in range(T):
    if dp[i][Gy-1][Gx-1]:
        print('Yes')
        exit(0)
print('No')
0