結果

問題 No.323 yuki国
ユーザー roiti46roiti46
提出日時 2015-12-16 00:37:31
言語 PyPy2
(7.3.13)
結果
AC  
実行時間 673 ms / 5,000 ms
コード長 806 bytes
コンパイル時間 130 ms
コンパイル使用メモリ 77,736 KB
実行使用メモリ 153,064 KB
最終ジャッジ日時 2023-09-10 21:15:07
合計ジャッジ時間 12,215 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 88 ms
79,308 KB
testcase_01 AC 89 ms
79,536 KB
testcase_02 AC 89 ms
79,204 KB
testcase_03 AC 90 ms
79,528 KB
testcase_04 AC 89 ms
79,328 KB
testcase_05 AC 108 ms
79,976 KB
testcase_06 AC 94 ms
79,636 KB
testcase_07 AC 90 ms
79,296 KB
testcase_08 AC 563 ms
133,932 KB
testcase_09 AC 535 ms
134,140 KB
testcase_10 AC 93 ms
79,328 KB
testcase_11 AC 139 ms
96,656 KB
testcase_12 AC 140 ms
96,496 KB
testcase_13 AC 545 ms
134,084 KB
testcase_14 AC 550 ms
135,672 KB
testcase_15 AC 483 ms
146,996 KB
testcase_16 AC 535 ms
136,044 KB
testcase_17 AC 582 ms
134,312 KB
testcase_18 AC 131 ms
83,848 KB
testcase_19 AC 496 ms
134,032 KB
testcase_20 AC 149 ms
88,996 KB
testcase_21 AC 671 ms
135,496 KB
testcase_22 AC 352 ms
114,460 KB
testcase_23 AC 673 ms
133,236 KB
testcase_24 AC 214 ms
109,956 KB
testcase_25 AC 590 ms
153,064 KB
testcase_26 AC 169 ms
86,268 KB
testcase_27 AC 204 ms
87,592 KB
testcase_28 AC 660 ms
130,368 KB
testcase_29 AC 603 ms
129,364 KB
testcase_30 AC 91 ms
79,236 KB
testcase_31 AC 89 ms
79,708 KB
testcase_32 AC 95 ms
79,896 KB
testcase_33 AC 90 ms
79,372 KB
testcase_34 AC 106 ms
79,640 KB
testcase_35 AC 90 ms
79,332 KB
testcase_36 AC 100 ms
79,728 KB
testcase_37 AC 91 ms
79,268 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

from collections import deque
dxy = zip([1, 0, -1, 0], [0, 1, 0, -1])
H, W = map(int, raw_input().split())
A, Sy, Sx = map(int, raw_input().split())
B, Gy, Gx = map(int, raw_input().split())
M = [raw_input() for i in xrange(H)]

que = deque([(A, Sx, Sy)])
used = [[[False]*51 for i in xrange(51)] for j in xrange(max(A, B) + 100)] 

while que:
    a, x, y = que.popleft()
    if used[a][x][y]: continue
    used[a][x][y] = True
    if Gx == x and Gy == y and a == B:
        print "Yes"
        break
    for dx, dy in dxy:
        nx, ny = x + dx, y + dy
        if 0 <= nx < W and 0 <= ny < H:
            na = a + (1 if M[ny][nx] == "*" else -1)
            if na <= 0 or na >= max(A, B) + 100: continue
            if used[na][nx][ny]: continue
            que.append((na, nx, ny))
else:
    print "No"
0