結果

問題 No.168 ものさし
ユーザー gigurururugigurururu
提出日時 2015-03-20 21:23:36
言語 Haskell
(9.8.2)
結果
TLE  
実行時間 -
コード長 733 bytes
コンパイル時間 3,143 ms
コンパイル使用メモリ 165,776 KB
実行使用メモリ 283,124 KB
最終ジャッジ日時 2023-09-11 09:08:08
合計ジャッジ時間 14,357 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 153 ms
47,440 KB
testcase_01 AC 3 ms
7,468 KB
testcase_02 AC 2 ms
7,476 KB
testcase_03 AC 2 ms
7,460 KB
testcase_04 AC 3 ms
7,384 KB
testcase_05 AC 2 ms
7,464 KB
testcase_06 AC 2 ms
7,464 KB
testcase_07 AC 2 ms
7,468 KB
testcase_08 AC 3 ms
7,460 KB
testcase_09 AC 12 ms
10,712 KB
testcase_10 AC 32 ms
15,708 KB
testcase_11 AC 283 ms
51,368 KB
testcase_12 AC 1,654 ms
224,664 KB
testcase_13 TLE -
testcase_14 TLE -
testcase_15 AC 2 ms
7,432 KB
testcase_16 AC 4 ms
8,488 KB
testcase_17 AC 12 ms
10,672 KB
testcase_18 AC 32 ms
17,016 KB
testcase_19 AC 783 ms
184,700 KB
testcase_20 AC 813 ms
180,048 KB
testcase_21 AC 844 ms
184,052 KB
testcase_22 AC 793 ms
179,956 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.6.1/environments/default
[1 of 2] Compiling Main             ( Main.hs, Main.o )
[2 of 2] Linking a.out

ソースコード

diff #

import Control.Applicative
import Control.Monad
import Data.Maybe
import Data.Graph
import qualified Data.ByteString.Char8 as B
 
hypot2 x y = x*x+y*y

solve n ls = bsearch 0 200000000
  where
    dst = [([(i,j),(j,i)],hypot2 (xi-xj) (yi-yj))|(i,[xi,yi])<-zip [0..] ls,(j,[xj,yj])<-zip [0..] ls,i<j]
    bsearch l r
      | l>=r      = l*10
      | check     = bsearch l c
      | otherwise = bsearch (c+1) r
        where
          c       = (l+r)`div`2
          check   = path gr 0 (n-1)
          gr      = buildG (0,n-1) $ concatMap fst $ filter ((100*c*c>=).snd) dst

main = do
  n  <- fst . fromJust . B.readInt <$> B.getLine
  ls <- replicateM n $ map (fst . fromJust . B.readInt) . B.words <$> B.getLine
  print $ solve n ls
0