結果
| 問題 |
No.1065 電柱 / Pole (Easy)
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-09-21 23:16:45 |
| 言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 724 bytes |
| コンパイル時間 | 297 ms |
| コンパイル使用メモリ | 12,160 KB |
| 実行使用メモリ | 161,248 KB |
| 最終ジャッジ日時 | 2025-09-21 23:18:16 |
| 合計ジャッジ時間 | 86,456 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | WA * 2 |
| other | AC * 2 WA * 28 TLE * 16 |
ソースコード
import sys
from scipy.sparse import coo_matrix
from scipy.sparse.csgraph import shortest_path
def input():
return sys.stdin.readline()[:-1]
def main():
N, M = map(int, input().split())
X, Y = map(int, input().split())
p, q = zip(*[map(int, input().split()) for _ in [0] * N])
P, Q = zip(*[map(int, input().split()) for _ in [0] * M])
dis = []
apnd = dis.append
for i, j in zip(P, Q):
apnd((p[j - 1] - p[i - 1]) ** 2 + (q[j - 1] - q[i - 1]) ** 2)
coo = coo_matrix((dis, (P, Q)), (N + 1, N + 1))
csr = coo.tocsr()
ans = shortest_path(csr, indices=X, directed=False)
print(ans[Y] ** 0.5)
if not __debug__:
f = open(sys.argv[1], "r")
sys.stdin = f
main()