結果
問題 | No.1638 Robot Maze |
ユーザー | puzneko |
提出日時 | 2021-12-02 23:38:48 |
言語 | PyPy3 (7.3.15) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,228 bytes |
コンパイル時間 | 144 ms |
コンパイル使用メモリ | 82,336 KB |
実行使用メモリ | 80,176 KB |
最終ジャッジ日時 | 2024-07-05 02:16:27 |
合計ジャッジ時間 | 6,021 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 43 ms
53,156 KB |
testcase_01 | AC | 41 ms
53,604 KB |
testcase_02 | AC | 40 ms
53,680 KB |
testcase_03 | WA | - |
testcase_04 | AC | 40 ms
52,824 KB |
testcase_05 | AC | 40 ms
53,932 KB |
testcase_06 | AC | 39 ms
53,996 KB |
testcase_07 | AC | 39 ms
53,584 KB |
testcase_08 | AC | 39 ms
53,448 KB |
testcase_09 | AC | 39 ms
53,688 KB |
testcase_10 | AC | 43 ms
52,824 KB |
testcase_11 | AC | 40 ms
52,828 KB |
testcase_12 | AC | 41 ms
53,220 KB |
testcase_13 | AC | 40 ms
53,224 KB |
testcase_14 | AC | 89 ms
77,508 KB |
testcase_15 | WA | - |
testcase_16 | AC | 129 ms
78,044 KB |
testcase_17 | AC | 55 ms
65,704 KB |
testcase_18 | AC | 103 ms
77,044 KB |
testcase_19 | AC | 44 ms
61,184 KB |
testcase_20 | AC | 45 ms
61,184 KB |
testcase_21 | AC | 46 ms
60,928 KB |
testcase_22 | AC | 139 ms
78,600 KB |
testcase_23 | AC | 167 ms
80,176 KB |
testcase_24 | AC | 46 ms
60,928 KB |
testcase_25 | AC | 46 ms
61,184 KB |
testcase_26 | AC | 134 ms
78,204 KB |
testcase_27 | WA | - |
testcase_28 | WA | - |
testcase_29 | AC | 149 ms
79,244 KB |
testcase_30 | AC | 39 ms
52,736 KB |
testcase_31 | AC | 41 ms
52,992 KB |
testcase_32 | AC | 134 ms
78,940 KB |
testcase_33 | AC | 134 ms
78,364 KB |
testcase_34 | WA | - |
testcase_35 | AC | 164 ms
79,752 KB |
testcase_36 | AC | 45 ms
61,712 KB |
testcase_37 | AC | 161 ms
80,132 KB |
testcase_38 | AC | 46 ms
61,312 KB |
testcase_39 | WA | - |
testcase_40 | AC | 143 ms
79,228 KB |
testcase_41 | AC | 157 ms
79,548 KB |
testcase_42 | AC | 109 ms
77,252 KB |
testcase_43 | AC | 163 ms
78,440 KB |
testcase_44 | AC | 122 ms
77,884 KB |
testcase_45 | AC | 75 ms
73,524 KB |
testcase_46 | AC | 46 ms
61,696 KB |
testcase_47 | AC | 139 ms
77,948 KB |
testcase_48 | AC | 46 ms
62,924 KB |
testcase_49 | AC | 99 ms
78,276 KB |
testcase_50 | AC | 128 ms
78,620 KB |
testcase_51 | AC | 47 ms
62,092 KB |
ソースコード
from sys import stdin from heapq import heappush, heappop h, w = [int(x) for x in stdin.readline().rstrip().split()] u, d, r, l, k, p = [int(x) for x in stdin.readline().rstrip().split()] xs, ys, xt, yt = [int(x) for x in stdin.readline().rstrip().split()] c = [stdin.readline().rstrip() for _ in range(h)] kabe = ["@" for i in range(w+2)] data = [kabe] for i in range(h): kari = ["@"] for j in range(w): kari.append(c[i][j]) kari.append("@") data.append(kari) data.append(kabe) hq = [(0,xs,ys)] infty = 10**18 dist = [[infty for i in range(w+2)] for j in range(h+2)] done = [[False for i in range(w+2)] for j in range(h+2)] dist[xs][ys] = 0 while hq: cost, nowx, nowy = heappop(hq) if not done[nowx][nowy]: if (nowx == xt) & (nowy == yt): if cost <= k: print("Yes") else: print("No") exit() done[nowx][nowy] = True if (data[nowx-1][nowy] != "@") & (not done[nowx-1][nowy]): nextcost = cost + u if data[nowx-1][nowy] == "#": nextcost += p if (dist[nowx-1][nowy] > nextcost): dist[nowx-1][nowy] = nextcost heappush(hq, (nextcost, nowx-1, nowy)) if (data[nowx+1][nowy] != "@") & (not done[nowx+1][nowy]): nextcost = cost + d if data[nowx+1][nowy] == "#": nextcost += p if (dist[nowx+1][nowy] > nextcost): dist[nowx+1][nowy] = nextcost heappush(hq, (nextcost, nowx+1, nowy)) if (data[nowx][nowy-1] != "@") & (not done[nowx][nowy-1]): nextcost = cost + l if data[nowx][nowy-1] == "#": nextcost += p if (dist[nowx][nowy-1] > nextcost): dist[nowx][nowy-1] = nextcost heappush(hq, (nextcost, nowx, nowy-1)) if (data[nowx][nowy+1] != "@") & (not done[nowx][nowy+1]): nextcost = cost + r if data[nowx][nowy+1] == "#": nextcost += p if (dist[nowx][nowy+1] > nextcost): dist[nowx][nowy+1] = nextcost heappush(hq, (nextcost, nowx, nowy+1)) print("No")