結果
問題 | No.1065 電柱 / Pole (Easy) |
ユーザー |
![]() |
提出日時 | 2020-06-02 22:22:04 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 684 bytes |
コンパイル時間 | 282 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 126,080 KB |
最終ジャッジ日時 | 2024-11-24 14:42:39 |
合計ジャッジ時間 | 46,333 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 41 TLE * 5 |
ソースコード
from sys import stdinfrom collections import dequereadline = stdin.readlineN, M = map(int, readline().split())X, Y = map(lambda x: int(x) - 1, readline().split())pq = [list(map(int, readline().split())) for _ in range(N)]PQ = [list(map(int, readline().split())) for _ in range(M)]links = [[] for _ in range(N)]for P, Q in PQ:links[P - 1].append(Q - 1)links[Q - 1].append(P - 1)q = deque([X])t = [float('inf')] * Nt[X] = 0while q:i = q.popleft()for j in links[i]:a, b = pq[i]c, d = pq[j]k = t[i] + ((a - c) * (a -c) + (b - d) * (b - d)) ** 0.5if k < t[j]:t[j] = kq.append(j)print(t[Y])