結果

問題 No.168 ものさし
ユーザー TawaraTawara
提出日時 2015-09-05 05:04:04
言語 PyPy2
(7.3.15)
結果
TLE  
実行時間 -
コード長 688 bytes
コンパイル時間 135 ms
コンパイル使用メモリ 77,720 KB
実行使用メモリ 105,100 KB
最終ジャッジ日時 2023-09-26 08:41:37
合計ジャッジ時間 10,676 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1,636 ms
98,076 KB
testcase_01 AC 132 ms
81,332 KB
testcase_02 AC 132 ms
81,340 KB
testcase_03 AC 131 ms
81,152 KB
testcase_04 AC 132 ms
81,468 KB
testcase_05 AC 132 ms
81,148 KB
testcase_06 AC 137 ms
81,284 KB
testcase_07 AC 132 ms
81,220 KB
testcase_08 AC 134 ms
81,328 KB
testcase_09 AC 291 ms
83,988 KB
testcase_10 AC 429 ms
86,440 KB
testcase_11 AC 1,549 ms
91,524 KB
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]]:
			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]
def dist(p1, p2):
	d = (Decimal((p1[0]-p2[0])**2 + (p1[1]-p2[1])**2)).sqrt()
	i_d = int(d)
	return i_d + (d>i_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) if j != i] for i in xrange(N)]
print (dijkstra(0,N-1,l,N)+9) / 10 * 10
0