結果

問題 No.2179 Planet Traveler
ユーザー titiatitia
提出日時 2023-01-10 02:07:27
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
WA  
実行時間 -
コード長 821 bytes
コンパイル時間 107 ms
コンパイル使用メモリ 11,000 KB
実行使用メモリ 12,964 KB
最終ジャッジ日時 2023-08-23 04:36:49
合計ジャッジ時間 11,799 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
12,964 KB
testcase_01 AC 17 ms
8,524 KB
testcase_02 AC 17 ms
8,504 KB
testcase_03 AC 18 ms
8,392 KB
testcase_04 AC 17 ms
8,460 KB
testcase_05 AC 17 ms
8,448 KB
testcase_06 AC 17 ms
8,536 KB
testcase_07 AC 17 ms
8,412 KB
testcase_08 AC 23 ms
8,400 KB
testcase_09 AC 24 ms
8,364 KB
testcase_10 AC 25 ms
8,524 KB
testcase_11 AC 1,310 ms
8,936 KB
testcase_12 AC 923 ms
8,728 KB
testcase_13 WA -
testcase_14 TLE -
testcase_15 TLE -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

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
eps=10**(-10)

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:
                dis=(sqrt(x1*x1+y1*y1)-sqrt(x0*x0+y0*y0))**2

                if dis<=mid+eps:
                    CAN[i]=1
                    Q.append(i)

    if CAN[N-1]==1:
        OK=mid
    else:
        NG=mid

print(OK)
0