結果
問題 | No.168 ものさし |
ユーザー | gigurururu |
提出日時 | 2015-03-25 23:47:06 |
言語 | Python3 (3.12.2 + numpy 1.26.4 + scipy 1.12.0) |
結果 |
AC
|
実行時間 | 717 ms / 2,000 ms |
コード長 | 570 bytes |
コンパイル時間 | 88 ms |
コンパイル使用メモリ | 10,924 KB |
実行使用メモリ | 181,316 KB |
最終ジャッジ日時 | 2023-08-25 20:54:12 |
合計ジャッジ時間 | 6,066 ms |
ジャッジサーバーID (参考情報) |
judge11 / judge12 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 181 ms
46,060 KB |
testcase_01 | AC | 16 ms
8,360 KB |
testcase_02 | AC | 16 ms
8,372 KB |
testcase_03 | AC | 17 ms
8,524 KB |
testcase_04 | AC | 16 ms
8,412 KB |
testcase_05 | AC | 16 ms
8,424 KB |
testcase_06 | AC | 16 ms
8,392 KB |
testcase_07 | AC | 17 ms
8,376 KB |
testcase_08 | AC | 16 ms
8,372 KB |
testcase_09 | AC | 21 ms
9,296 KB |
testcase_10 | AC | 34 ms
12,244 KB |
testcase_11 | AC | 163 ms
41,692 KB |
testcase_12 | AC | 410 ms
115,480 KB |
testcase_13 | AC | 717 ms
175,560 KB |
testcase_14 | AC | 480 ms
146,372 KB |
testcase_15 | AC | 17 ms
8,500 KB |
testcase_16 | AC | 20 ms
8,788 KB |
testcase_17 | AC | 26 ms
10,440 KB |
testcase_18 | AC | 40 ms
14,544 KB |
testcase_19 | AC | 532 ms
160,100 KB |
testcase_20 | AC | 514 ms
159,428 KB |
testcase_21 | AC | 690 ms
181,316 KB |
testcase_22 | AC | 542 ms
164,200 KB |
ソースコード
import heapq,math def hypot2(x,y): return x*x+y*y def solve(n,l): dst=[[(hypot2(x1-x2,y1-y2),j)for j,(x2,y2) in enumerate(l)] for x1,y1 in l] visited = set() pq = [(0,0)] mx=10 while len(pq): my,d = heapq.heappop(pq) if(mx<my):mx=my if(d==n-1):break if(d in visited):continue visited.add(d) for s,i in dst[d]: if(i in visited):continue heapq.heappush(pq,(s,i)) ans=int(math.sqrt(mx))//10*10 return(ans+10 if ans*ans<mx else ans) n=int(input()) l=[list(map(int,input().split())) for _ in range(n)] print(solve(n,l))