結果

問題 No.490 yukiソート
ユーザー 34056915823405691582
提出日時 2017-03-24 17:18:43
言語 Haskell
(9.6.2)
結果
WA  
実行時間 -
コード長 478 bytes
コンパイル時間 7,415 ms
コンパイル使用メモリ 166,312 KB
実行使用メモリ 11,344 KB
最終ジャッジ日時 2023-09-20 05:55:39
合計ジャッジ時間 6,985 ms
ジャッジサーバーID
(参考情報)
judge15 / judge14
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
6,892 KB
testcase_01 AC 3 ms
6,888 KB
testcase_02 AC 3 ms
7,048 KB
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 TLE -
testcase_15 -- -
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 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 Data.Array 
import Data.List
main = do
  n <- read <$> getLine
  as <- map read . words <$> getLine
  putStrLn $ intersperse ' ' $ concat $ map show $ elems $ yukiSort n as

yukiSort :: Int -> [Int] -> Array Int Int
yukiSort n as = yS (listArray (0,n-1) as) [1..2*n-3]
  where yS aa [] = aa
        yS aa (i:is) = yS (foldl (\a p->if a!p>a!(i-p) then a//[(p,a!(i-p)),(i-p,a!p)] else a) aa ps) is
          where ps = takeWhile ((i>).(*2)) $ dropWhile ((n-1<=).(i-)) [0..]
0