結果

問題 No.2179 Planet Traveler
ユーザー titiatitia
提出日時 2023-01-10 02:20:52
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
TLE  
実行時間 -
コード長 913 bytes
コンパイル時間 99 ms
コンパイル使用メモリ 10,912 KB
実行使用メモリ 8,668 KB
最終ジャッジ日時 2023-08-23 04:43:58
合計ジャッジ時間 11,608 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 17 ms
8,300 KB
testcase_01 AC 17 ms
8,288 KB
testcase_02 AC 17 ms
8,384 KB
testcase_03 AC 16 ms
8,284 KB
testcase_04 AC 17 ms
8,396 KB
testcase_05 AC 17 ms
8,340 KB
testcase_06 AC 17 ms
8,296 KB
testcase_07 AC 18 ms
8,388 KB
testcase_08 AC 25 ms
8,320 KB
testcase_09 AC 23 ms
8,296 KB
testcase_10 AC 25 ms
8,268 KB
testcase_11 AC 1,298 ms
8,620 KB
testcase_12 AC 928 ms
8,520 KB
testcase_13 AC 659 ms
8,668 KB
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

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)
0