結果

問題 No.2179 Planet Traveler
ユーザー 👑 p-adicp-adic
提出日時 2023-05-30 08:16:05
言語 Python3
(3.12.2 + numpy 1.26.4 + scipy 1.12.0)
結果
AC  
実行時間 1,220 ms / 3,000 ms
コード長 527 bytes
コンパイル時間 591 ms
コンパイル使用メモリ 10,840 KB
実行使用メモリ 34,240 KB
最終ジャッジ日時 2023-08-28 00:24:21
合計ジャッジ時間 17,136 ms
ジャッジサーバーID
(参考情報)
judge11 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 16 ms
8,028 KB
testcase_01 AC 16 ms
8,008 KB
testcase_02 AC 17 ms
8,132 KB
testcase_03 AC 17 ms
8,140 KB
testcase_04 AC 16 ms
8,076 KB
testcase_05 AC 16 ms
8,084 KB
testcase_06 AC 17 ms
8,072 KB
testcase_07 AC 17 ms
8,080 KB
testcase_08 AC 19 ms
8,132 KB
testcase_09 AC 19 ms
8,136 KB
testcase_10 AC 19 ms
8,084 KB
testcase_11 AC 672 ms
33,704 KB
testcase_12 AC 1,220 ms
32,840 KB
testcase_13 AC 1,087 ms
33,692 KB
testcase_14 AC 657 ms
34,224 KB
testcase_15 AC 663 ms
34,204 KB
testcase_16 AC 666 ms
34,240 KB
testcase_17 AC 1,070 ms
33,100 KB
testcase_18 AC 1,058 ms
33,040 KB
testcase_19 AC 1,068 ms
33,180 KB
testcase_20 AC 153 ms
11,520 KB
testcase_21 AC 1,007 ms
31,192 KB
testcase_22 AC 652 ms
23,408 KB
testcase_23 AC 585 ms
21,504 KB
testcase_24 AC 855 ms
28,436 KB
testcase_25 AC 710 ms
24,200 KB
testcase_26 AC 950 ms
30,404 KB
testcase_27 AC 159 ms
11,680 KB
testcase_28 AC 470 ms
18,788 KB
testcase_29 AC 873 ms
28,424 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

import math
I,R=input,range
def J():
	return map(int,I().split())
N=int(I())
P=[0]*N
for i in R(N):
	X,Y,T=J()
	P[i]=[X*X+Y*Y,X,Y,T]
D=[[0]*N for i in R(N)]
for i in R(N):
	p=P[i]
	for j in R(N):
		q=P[j]
		if p[3]==q[3]:u=(q[1]-p[1])**2+(q[2]-p[2])**2
		else:
			s=4*p[0]*q[0]
			r=int(math.sqrt(s))+1
			while s<r*r:r-=1
			u=p[0]-r+q[0]
		D[i][j]=u
M=3200000001
W=[M]*N
W[0]=0
Q={i for i in R(N)}
while len(Q):
	e,w=N,M
	for q in Q:
		if w>W[q]:e,w=q,W[q]
	Q.remove(e)
	for q in Q:W[q]=min(W[q],max(w,D[e][q]))
print(W[N-1])
0