結果
問題 | No.1065 電柱 / Pole (Easy) |
ユーザー | 6soukiti29 |
提出日時 | 2020-05-30 17:17:06 |
言語 | Nim (2.0.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,275 bytes |
コンパイル時間 | 3,974 ms |
コンパイル使用メモリ | 72,440 KB |
実行使用メモリ | 41,776 KB |
最終ジャッジ日時 | 2023-08-07 16:15:02 |
合計ジャッジ時間 | 12,225 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 16 ms
13,352 KB |
testcase_01 | WA | - |
testcase_02 | AC | 172 ms
25,656 KB |
testcase_03 | WA | - |
testcase_04 | WA | - |
testcase_05 | AC | 246 ms
38,600 KB |
testcase_06 | AC | 241 ms
39,244 KB |
testcase_07 | AC | 93 ms
20,968 KB |
testcase_08 | AC | 299 ms
30,548 KB |
testcase_09 | AC | 47 ms
17,960 KB |
testcase_10 | AC | 141 ms
21,704 KB |
testcase_11 | AC | 104 ms
20,836 KB |
testcase_12 | AC | 88 ms
24,360 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | TLE | - |
testcase_16 | -- | - |
testcase_17 | -- | - |
testcase_18 | -- | - |
testcase_19 | -- | - |
testcase_20 | -- | - |
testcase_21 | -- | - |
testcase_22 | -- | - |
testcase_23 | -- | - |
testcase_24 | -- | - |
testcase_25 | -- | - |
testcase_26 | -- | - |
testcase_27 | -- | - |
testcase_28 | -- | - |
testcase_29 | -- | - |
testcase_30 | -- | - |
testcase_31 | -- | - |
testcase_32 | -- | - |
testcase_33 | -- | - |
testcase_34 | -- | - |
testcase_35 | -- | - |
testcase_36 | -- | - |
testcase_37 | -- | - |
testcase_38 | -- | - |
testcase_39 | -- | - |
testcase_40 | -- | - |
testcase_41 | -- | - |
testcase_42 | -- | - |
testcase_43 | -- | - |
testcase_44 | -- | - |
testcase_45 | -- | - |
testcase_46 | -- | - |
testcase_47 | -- | - |
ソースコード
import sequtils,strutils,math,heapqueue type sen = tuple[b : int, d : float64 ] t = tuple[cost : float64, p : int] var N, M : int X, Y : int p,q : int dentyuu = newSeq[array[2,int]](0) densen = newSeqWith(200010, newSeq[sen](0)) hyou : array[200010, float64] (N, M) = stdin.readline.split.map(parseInt) (X, Y) = stdin.readline.split.map(parseInt) X -= 1 Y -= 1 for n in 1..N: (p,q) = stdin.readline.split.map(parseInt) dentyuu.add([p, q]) for m in 1..M: (p, q) = stdin.readline.split.map(parseInt) p -= 1 q -= 1 var dx : float = (dentyuu[p][0] - dentyuu[q][0]).float var dy : float = (dentyuu[p][1] - dentyuu[q][1]).float dx = dx * dx dy = dy * dy var d = sqrt(dx + dy) var l : sen = (q, d) densen[p].add(l) l = (p, d) densen[q].add(l) for i in 0..200000: hyou[i] = 1e10 proc `<` (a, b : t) : bool = a.cost > b.cost var hp = initHeapQueue[t]() var i : t = (0.0, X) hp.push(i) while true: var P = hp.pop() if hyou[P.p] < P.cost: continue if P.p == Y: break hyou[P.p] = P.cost for s in densen[P.p]: if hyou[s[0]] > s[1] + hyou[P.p]: hp.push((s[1] + hyou[P.p], s[0])) hyou[s[0]] = s[1] + hyou[P.p] echo hyou[Y]