結果
問題 | No.1065 電柱 / Pole (Easy) |
ユーザー | mkawa2 |
提出日時 | 2021-05-28 17:42:31 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
TLE
(最新)
AC
(最初)
|
実行時間 | - |
コード長 | 1,314 bytes |
コンパイル時間 | 267 ms |
コンパイル使用メモリ | 12,800 KB |
実行使用メモリ | 118,528 KB |
最終ジャッジ日時 | 2024-11-07 06:09:52 |
合計ジャッジ時間 | 39,395 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 32 ms
10,880 KB |
testcase_01 | AC | 30 ms
10,624 KB |
testcase_02 | AC | 747 ms
61,952 KB |
testcase_03 | AC | 1,325 ms
104,012 KB |
testcase_04 | AC | 1,480 ms
103,220 KB |
testcase_05 | AC | 1,242 ms
95,704 KB |
testcase_06 | AC | 1,296 ms
95,572 KB |
testcase_07 | AC | 353 ms
39,296 KB |
testcase_08 | AC | 1,410 ms
118,528 KB |
testcase_09 | AC | 133 ms
19,840 KB |
testcase_10 | AC | 590 ms
58,624 KB |
testcase_11 | AC | 417 ms
43,776 KB |
testcase_12 | AC | 343 ms
31,104 KB |
testcase_13 | AC | 1,142 ms
70,144 KB |
testcase_14 | AC | 1,253 ms
80,000 KB |
testcase_15 | AC | 1,556 ms
91,648 KB |
testcase_16 | AC | 746 ms
49,792 KB |
testcase_17 | AC | 1,804 ms
97,528 KB |
testcase_18 | AC | 599 ms
39,296 KB |
testcase_19 | AC | 1,496 ms
92,288 KB |
testcase_20 | AC | 415 ms
34,176 KB |
testcase_21 | AC | 749 ms
44,800 KB |
testcase_22 | AC | 1,431 ms
86,400 KB |
testcase_23 | AC | 46 ms
11,648 KB |
testcase_24 | AC | 46 ms
11,904 KB |
testcase_25 | AC | 292 ms
29,056 KB |
testcase_26 | AC | 688 ms
54,400 KB |
testcase_27 | AC | 752 ms
55,936 KB |
testcase_28 | AC | 1,228 ms
83,712 KB |
testcase_29 | AC | 212 ms
20,736 KB |
testcase_30 | AC | 1,325 ms
90,712 KB |
testcase_31 | AC | 1,027 ms
69,092 KB |
testcase_32 | AC | 539 ms
47,360 KB |
testcase_33 | AC | 1,516 ms
92,912 KB |
testcase_34 | AC | 574 ms
40,960 KB |
testcase_35 | AC | 1,195 ms
90,544 KB |
testcase_36 | AC | 36 ms
11,264 KB |
testcase_37 | AC | 41 ms
11,648 KB |
testcase_38 | AC | 38 ms
11,264 KB |
testcase_39 | AC | 40 ms
11,776 KB |
testcase_40 | AC | 33 ms
11,136 KB |
testcase_41 | TLE | - |
testcase_42 | AC | 546 ms
43,264 KB |
testcase_43 | AC | 893 ms
65,408 KB |
testcase_44 | AC | 283 ms
30,592 KB |
testcase_45 | AC | 1,061 ms
66,176 KB |
testcase_46 | AC | 31 ms
10,752 KB |
testcase_47 | AC | 31 ms
10,880 KB |
ソースコード
import sys sys.setrecursionlimit(200005) int1 = lambda x: int(x)-1 p2D = lambda x: print(*x, sep="\n") def II(): return int(sys.stdin.buffer.readline()) def LI(): return list(map(int, sys.stdin.buffer.readline().split())) def LI1(): return list(map(int1, sys.stdin.buffer.readline().split())) def LLI(rows_number): return [LI() for _ in range(rows_number)] def LLI1(rows_number): return [LI1() for _ in range(rows_number)] def BI(): return sys.stdin.buffer.readline().rstrip() def SI(): return sys.stdin.buffer.readline().rstrip().decode() # dij = [(0, 1), (-1, 0), (0, -1), (1, 0)] # dij = [(0, 1), (-1, 0), (0, -1), (1, 0), (1, 1), (1, -1), (-1, 1), (-1, -1)] dij = [(0, 1), (1, 0), (1, 1), (1, -1)] inf = 10**16 # md = 998244353 md = 10**9+7 from heapq import * def Dist(u, v): x0, y0 = xy[u] x1, y1 = xy[v] return ((x1-x0)**2+(y1-y0)**2)**0.5 n, m = LI() su, gu = LI1() xy = LLI(n) to = [[] for _ in range(n)] for _ in range(m): u, v = LI1() d = Dist(u, v) to[u].append((v, d)) to[v].append((u, d)) dist = [inf]*n dist[su] = 0 hp = [(0, su)] while hp: d, u = heappop(hp) if u == gu: print(d) break if d > dist[u]: continue for v, c in to[u]: nd = d+c if nd >= dist[v]: continue dist[v] = nd heappush(hp, (nd, v))