結果

問題 No.2646 Cycle Maze
ユーザー nikoro256nikoro256
提出日時 2024-02-25 18:30:46
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 993 bytes
コンパイル時間 339 ms
コンパイル使用メモリ 81,700 KB
実行使用メモリ 275,744 KB
最終ジャッジ日時 2024-02-25 18:31:11
合計ジャッジ時間 23,606 ms
ジャッジサーバーID
(参考情報)
judge15 / judge10
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
55,604 KB
testcase_01 AC 40 ms
55,608 KB
testcase_02 AC 39 ms
55,608 KB
testcase_03 AC 48 ms
64,036 KB
testcase_04 AC 40 ms
55,608 KB
testcase_05 AC 40 ms
55,604 KB
testcase_06 AC 40 ms
55,604 KB
testcase_07 AC 40 ms
55,604 KB
testcase_08 WA -
testcase_09 AC 39 ms
55,608 KB
testcase_10 AC 40 ms
55,608 KB
testcase_11 WA -
testcase_12 AC 39 ms
55,608 KB
testcase_13 WA -
testcase_14 AC 39 ms
55,608 KB
testcase_15 WA -
testcase_16 AC 40 ms
55,608 KB
testcase_17 AC 41 ms
55,608 KB
testcase_18 WA -
testcase_19 AC 41 ms
55,608 KB
testcase_20 AC 42 ms
55,608 KB
testcase_21 WA -
testcase_22 AC 45 ms
61,580 KB
testcase_23 AC 40 ms
55,608 KB
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 468 ms
112,928 KB
testcase_27 AC 491 ms
121,632 KB
testcase_28 AC 166 ms
84,164 KB
testcase_29 AC 727 ms
132,256 KB
testcase_30 WA -
testcase_31 AC 347 ms
106,272 KB
testcase_32 AC 60 ms
68,472 KB
testcase_33 AC 107 ms
85,536 KB
testcase_34 AC 163 ms
95,136 KB
testcase_35 AC 407 ms
108,064 KB
testcase_36 AC 120 ms
84,772 KB
testcase_37 AC 212 ms
101,536 KB
testcase_38 AC 146 ms
82,392 KB
testcase_39 AC 471 ms
112,416 KB
testcase_40 AC 274 ms
94,752 KB
testcase_41 AC 414 ms
107,424 KB
testcase_42 AC 114 ms
81,260 KB
testcase_43 AC 108 ms
79,652 KB
testcase_44 AC 228 ms
91,168 KB
testcase_45 AC 574 ms
140,704 KB
testcase_46 AC 704 ms
161,312 KB
testcase_47 AC 2,187 ms
258,336 KB
testcase_48 AC 541 ms
145,312 KB
testcase_49 AC 2,376 ms
262,816 KB
testcase_50 AC 681 ms
172,192 KB
testcase_51 AC 1,344 ms
219,808 KB
testcase_52 WA -
testcase_53 AC 2,331 ms
275,744 KB
testcase_54 AC 2,273 ms
275,744 KB
権限があれば一括ダウンロードができます

ソースコード

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]]:
                    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