結果
問題 | No.94 圏外です。(EASY) |
ユーザー | 6soukiti29 |
提出日時 | 2017-08-17 06:03:35 |
言語 | Nim (2.0.2) |
結果 |
AC
|
実行時間 | 20 ms / 5,000 ms |
コード長 | 1,454 bytes |
コンパイル時間 | 2,999 ms |
コンパイル使用メモリ | 68,104 KB |
実行使用メモリ | 11,140 KB |
最終ジャッジ日時 | 2023-09-12 14:44:20 |
合計ジャッジ時間 | 4,506 ms |
ジャッジサーバーID (参考情報) |
judge12 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
4,376 KB |
testcase_01 | AC | 2 ms
4,376 KB |
testcase_02 | AC | 2 ms
4,380 KB |
testcase_03 | AC | 1 ms
4,376 KB |
testcase_04 | AC | 2 ms
4,376 KB |
testcase_05 | AC | 3 ms
4,444 KB |
testcase_06 | AC | 5 ms
6,816 KB |
testcase_07 | AC | 7 ms
9,208 KB |
testcase_08 | AC | 10 ms
9,224 KB |
testcase_09 | AC | 20 ms
11,048 KB |
testcase_10 | AC | 18 ms
11,080 KB |
testcase_11 | AC | 18 ms
11,040 KB |
testcase_12 | AC | 18 ms
11,100 KB |
testcase_13 | AC | 19 ms
10,968 KB |
testcase_14 | AC | 20 ms
11,140 KB |
testcase_15 | AC | 20 ms
10,980 KB |
testcase_16 | AC | 19 ms
11,052 KB |
testcase_17 | AC | 20 ms
11,080 KB |
testcase_18 | AC | 19 ms
10,968 KB |
testcase_19 | AC | 15 ms
11,076 KB |
testcase_20 | AC | 2 ms
4,380 KB |
testcase_21 | AC | 2 ms
4,376 KB |
ソースコード
import sequtils,strutils,math type unionfindtree[I : static[int]] = array[I,int] proc find(U : unionfindtree; a : int, b :int): bool= var s = a t = b while s != U[s]: s = U[s] while t != U[t]: t = U[t] return s == t proc union(U : var unionfindtree; a : int ; b : int)= if U.find(a,b): return var s = a t = b t2 : int while s != U[s]: s = U[s] while t != U[t]: t2 = U[t] U[t] = s t = t2 U[t] = s proc root(U : unionfindtree, a :int):int= var s = a while s != U[s]: s = U[s] return s proc distance(a,b,c,d : int): float64 = var A = a.float64 - c.float64 B = b.float64 - d.float64 return sqrt(A * A + B * B) var N = stdin.readline.parseInt D : array[1000,array[1000,float64]] P : array[1000,array[2,int]] UT : unionfindtree[1000] x,y : int for i in 0..<1000: UT[i] = i for n in 0..<N: (x,y) = stdin.readline.split.map(parseInt) P[n] = [x,y] for m in 0..<n: var d = distance(x,y,P[m][0],P[m][1]) D[n][m] = d D[m][n] = d if d <= 10.00001: UT.union(m,n) var memo : tuple[id1,id2 : int; dis : float64] for n in 0..<N: for m in 0..<n: if UT.find(n,m) and memo.dis < D[n][m]: memo = (n,m,D[n][m]) if N > 0: echo memo.dis + 2 else: echo 1