結果

問題 No.168 ものさし
ユーザー TawaraTawara
提出日時 2015-09-05 04:44:08
言語 PyPy2
(7.3.15)
結果
TLE  
実行時間 -
コード長 667 bytes
コンパイル時間 1,212 ms
コンパイル使用メモリ 77,952 KB
実行使用メモリ 101,264 KB
最終ジャッジ日時 2023-09-26 08:39:41
合計ジャッジ時間 14,247 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 TLE -
testcase_01 AC 134 ms
81,284 KB
testcase_02 AC 131 ms
81,512 KB
testcase_03 AC 134 ms
81,340 KB
testcase_04 AC 134 ms
81,192 KB
testcase_05 AC 135 ms
81,496 KB
testcase_06 AC 145 ms
81,684 KB
testcase_07 AC 133 ms
81,296 KB
testcase_08 AC 134 ms
81,180 KB
testcase_09 AC 391 ms
85,272 KB
testcase_10 AC 571 ms
85,756 KB
testcase_11 TLE -
testcase_12 TLE -
testcase_13 -- -
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
MAX = 2*10**9
def dijkstra (s, t, L, n):
	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]]:
			tmpd = max(tmp[0],v[0])
			if tmpd < d[v[1]]:
				d[v[1]] = tmpd
				hpush(Q, (tmpd,v[1]))
	return d[t]
def dist(p1, p2):
	d = (Decimal((p1[0] - p2[0])**2) + Decimal((p1[1] - p2[1])**2)).sqrt()
	return int(d) + 1 if d - int(d) > 0 else int(d)

N = int(raw_input())
xy = [map(int,raw_input().split()) for i in xrange(N)]
l = [[(dist(xy[i],xy[j]),j) for j in xrange(N)] for i in xrange(N)]
print (dijkstra(0,N-1,l,N)+9) / 10 * 10
0