結果
問題 | No.2179 Planet Traveler |
ユーザー |
![]() |
提出日時 | 2023-01-10 02:20:52 |
言語 | Python3 (3.13.1 + numpy 2.2.1 + scipy 1.14.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 913 bytes |
コンパイル時間 | 105 ms |
コンパイル使用メモリ | 12,672 KB |
実行使用メモリ | 21,888 KB |
最終ジャッジ日時 | 2024-12-21 04:42:12 |
合計ジャッジ時間 | 55,599 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 15 TLE * 11 |
ソースコード
import sys input = sys.stdin.readline from math import sqrt N=int(input()) P=[list(map(int,input().split())) for i in range(N)] OK=3200000000 NG=-1 while OK>NG+1: mid=(OK+NG)//2 CAN=[0]*N CAN[0]=1 Q=[0] while Q: x=Q.pop() x0,y0,t0=P[x] for i in range(N): if CAN[i]==1: continue x1,y1,t1=P[i] if t0==t1: dis=(x0-x1)**2+(y0-y1)**2 if dis<=mid: CAN[i]=1 Q.append(i) else: a=(x1*x1+y1*y1) b=(x0*x0+y0*y0) if a+b-mid<0.8: CAN[i]=1 Q.append(i) elif (a+b-mid)**2<=4*a*b: CAN[i]=1 Q.append(i) if CAN[N-1]==1: OK=mid else: NG=mid print(OK)