結果
問題 | No.490 yukiソート |
ユーザー |
![]() |
提出日時 | 2017-03-24 17:26:42 |
言語 | Haskell (9.10.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 477 bytes |
コンパイル時間 | 4,451 ms |
コンパイル使用メモリ | 174,720 KB |
実行使用メモリ | 19,228 KB |
最終ジャッジ日時 | 2024-07-06 02:00:19 |
合計ジャッジ時間 | 6,033 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 2 |
other | AC * 8 WA * 6 TLE * 1 -- * 19 |
コンパイルメッセージ
Loaded package environment from /home/judge/.ghc/x86_64-linux-9.8.2/environments/default [1 of 2] Compiling Main ( Main.hs, Main.o ) [2 of 2] Linking a.out
ソースコード
importData.ArrayimportData.Listmain = don <- read <$> getLineas <- map read . words <$> getLineputStrLn $ concat $ intersperse " " $ map show $ elems $ yukiSort n asyukiSort::Int->Int->ArrayIntIntyukiSort n as = yS (listArray (0,n-1) as) [1..2*n-3]where yS aa [] = aayS 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) iswhere ps = takeWhile ((i>).(*2)) $ dropWhile ((n-1<).(i-)) [0..]