結果

問題 No.168 ものさし
ユーザー TawaraTawara
提出日時 2015-09-05 17:27:07
言語 Python2
(2.7.18)
結果
TLE  
実行時間 -
コード長 702 bytes
コンパイル時間 695 ms
コンパイル使用メモリ 6,632 KB
実行使用メモリ 147,864 KB
最終ジャッジ日時 2023-09-26 08:49:15
合計ジャッジ時間 10,457 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 931 ms
41,768 KB
testcase_01 AC 21 ms
7,684 KB
testcase_02 AC 20 ms
7,752 KB
testcase_03 AC 21 ms
7,584 KB
testcase_04 AC 21 ms
7,744 KB
testcase_05 AC 21 ms
7,860 KB
testcase_06 AC 21 ms
7,720 KB
testcase_07 AC 21 ms
7,608 KB
testcase_08 AC 20 ms
7,852 KB
testcase_09 AC 34 ms
8,160 KB
testcase_10 AC 77 ms
10,564 KB
testcase_11 AC 487 ms
33,952 KB
testcase_12 TLE -
testcase_13 TLE -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

from heapq import heappop as hpop, heappush as hpush
from decimal import Decimal
def sq_dist(p1, p2):
	return (p1[0]-p2[0])**2+(p1[1]-p2[1])**2
def solve(s, t, L, n):
	MAX = sq_dist(xy[s],xy[t])
	d = [MAX for i in range(n)]
	Q = list()
	d[s] = 0
	hpush(Q,(0,s))
	while Q:
		tmp = hpop(Q)
		for v in L[tmp[1]]:
			if tmp[0] > v[0]:
				tmpd = tmp[0]
			else:
				tmpd = v[0]
			if tmpd < d[v[1]]:
				d[v[1]] = tmpd
				hpush(Q,(tmpd,v[1]))
	return d[t]
	
N = int(raw_input())
xy = [map(int,raw_input().split()) for i in xrange(N)]
l = [[(sq_dist(xy[i],xy[j]),j) for j in xrange(N) if j != i] for i in xrange(N)]
max_d = Decimal(solve(0,N-1,l,N)).sqrt()
print (int(max_d)+(max_d>int(max_d))+9) / 10 * 10
0