結果

問題 No.2646 Cycle Maze
ユーザー nikoro256nikoro256
提出日時 2024-02-25 18:48:44
言語 PyPy3
(7.3.15)
結果
TLE  
実行時間 -
コード長 1,116 bytes
コンパイル時間 364 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 282,420 KB
最終ジャッジ日時 2024-02-25 18:49:04
合計ジャッジ時間 18,674 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 39 ms
55,604 KB
testcase_01 AC 37 ms
55,604 KB
testcase_02 AC 38 ms
55,604 KB
testcase_03 AC 46 ms
64,040 KB
testcase_04 AC 39 ms
55,604 KB
testcase_05 AC 41 ms
55,604 KB
testcase_06 AC 38 ms
55,604 KB
testcase_07 AC 39 ms
55,604 KB
testcase_08 AC 39 ms
55,604 KB
testcase_09 AC 39 ms
55,604 KB
testcase_10 AC 52 ms
64,064 KB
testcase_11 AC 39 ms
55,604 KB
testcase_12 AC 39 ms
55,604 KB
testcase_13 AC 38 ms
55,604 KB
testcase_14 AC 38 ms
55,604 KB
testcase_15 AC 38 ms
55,604 KB
testcase_16 AC 38 ms
55,604 KB
testcase_17 AC 38 ms
55,604 KB
testcase_18 AC 38 ms
55,604 KB
testcase_19 AC 39 ms
55,604 KB
testcase_20 AC 39 ms
55,604 KB
testcase_21 AC 38 ms
55,604 KB
testcase_22 AC 41 ms
61,580 KB
testcase_23 AC 38 ms
55,604 KB
testcase_24 AC 38 ms
55,604 KB
testcase_25 AC 178 ms
127,136 KB
testcase_26 AC 183 ms
112,928 KB
testcase_27 AC 322 ms
121,760 KB
testcase_28 AC 104 ms
84,292 KB
testcase_29 AC 183 ms
132,256 KB
testcase_30 AC 158 ms
112,928 KB
testcase_31 AC 94 ms
87,840 KB
testcase_32 AC 57 ms
68,476 KB
testcase_33 AC 121 ms
85,664 KB
testcase_34 AC 227 ms
95,136 KB
testcase_35 AC 212 ms
108,064 KB
testcase_36 AC 136 ms
85,152 KB
testcase_37 AC 141 ms
101,536 KB
testcase_38 AC 85 ms
82,388 KB
testcase_39 AC 171 ms
112,416 KB
testcase_40 AC 90 ms
87,456 KB
testcase_41 AC 192 ms
107,424 KB
testcase_42 AC 107 ms
81,640 KB
testcase_43 AC 142 ms
79,660 KB
testcase_44 AC 128 ms
91,168 KB
testcase_45 AC 598 ms
140,704 KB
testcase_46 AC 635 ms
161,312 KB
testcase_47 AC 412 ms
258,336 KB
testcase_48 AC 446 ms
145,440 KB
testcase_49 AC 917 ms
263,072 KB
testcase_50 AC 1,092 ms
172,192 KB
testcase_51 AC 2,481 ms
219,808 KB
testcase_52 TLE -
testcase_53 TLE -
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]:
                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-1)%(A[x][y]+1)!=0:
                        dp[i+1][x][y]=True
                        if x==Gy and y==Gx:
                            print('Yes')
                            exit(0)
for i in range(T):
    if dp[i][Gy-1][Gx-1]:
        print('Yes')
        exit(0)
print('No')
0