結果

問題 No.2179 Planet Traveler
ユーザー titiatitia
提出日時 2023-01-10 02:11:37
言語 PyPy3
(7.3.15)
結果
WA  
実行時間 -
コード長 795 bytes
コンパイル時間 264 ms
コンパイル使用メモリ 86,988 KB
実行使用メモリ 77,400 KB
最終ジャッジ日時 2023-08-23 04:38:51
合計ジャッジ時間 5,408 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 75 ms
71,460 KB
testcase_02 WA -
testcase_03 AC 72 ms
71,176 KB
testcase_04 WA -
testcase_05 WA -
testcase_06 AC 74 ms
71,464 KB
testcase_07 AC 77 ms
76,164 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 AC 246 ms
76,652 KB
testcase_12 AC 127 ms
76,872 KB
testcase_13 AC 119 ms
76,856 KB
testcase_14 AC 224 ms
76,692 KB
testcase_15 AC 256 ms
76,680 KB
testcase_16 AC 238 ms
76,644 KB
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

import sys
input = sys.stdin.readline

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)**2<=4*a*b:
                    CAN[i]=1
                    Q.append(i)

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

print(OK)
0