結果

問題 No.323 yuki国
ユーザー roiti46roiti46
提出日時 2015-12-16 00:32:58
言語 PyPy2
(7.3.13)
結果
AC  
実行時間 3,035 ms / 5,000 ms
コード長 766 bytes
コンパイル時間 135 ms
コンパイル使用メモリ 77,624 KB
実行使用メモリ 116,236 KB
最終ジャッジ日時 2023-10-14 10:23:42
合計ジャッジ時間 27,613 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
78,868 KB
testcase_01 AC 79 ms
79,404 KB
testcase_02 AC 78 ms
78,864 KB
testcase_03 AC 79 ms
79,052 KB
testcase_04 AC 80 ms
78,868 KB
testcase_05 AC 101 ms
79,672 KB
testcase_06 AC 85 ms
79,520 KB
testcase_07 AC 79 ms
79,180 KB
testcase_08 AC 1,073 ms
110,812 KB
testcase_09 AC 1,095 ms
110,712 KB
testcase_10 AC 82 ms
79,156 KB
testcase_11 AC 134 ms
100,672 KB
testcase_12 AC 133 ms
100,520 KB
testcase_13 AC 1,123 ms
110,992 KB
testcase_14 AC 1,144 ms
111,144 KB
testcase_15 AC 3,035 ms
114,544 KB
testcase_16 AC 1,368 ms
111,000 KB
testcase_17 AC 1,374 ms
111,112 KB
testcase_18 AC 114 ms
79,912 KB
testcase_19 AC 1,154 ms
111,736 KB
testcase_20 AC 159 ms
87,596 KB
testcase_21 AC 1,725 ms
110,832 KB
testcase_22 AC 1,119 ms
106,648 KB
testcase_23 AC 2,125 ms
110,672 KB
testcase_24 AC 405 ms
108,128 KB
testcase_25 AC 2,943 ms
116,236 KB
testcase_26 AC 367 ms
84,280 KB
testcase_27 AC 418 ms
83,708 KB
testcase_28 AC 1,014 ms
109,912 KB
testcase_29 AC 992 ms
109,680 KB
testcase_30 AC 80 ms
79,320 KB
testcase_31 AC 79 ms
79,200 KB
testcase_32 AC 88 ms
79,672 KB
testcase_33 AC 82 ms
79,196 KB
testcase_34 AC 93 ms
79,656 KB
testcase_35 AC 82 ms
79,324 KB
testcase_36 AC 88 ms
79,776 KB
testcase_37 AC 82 ms
79,036 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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 = [(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.pop(0)
    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