結果
問題 |
No.490 yukiソート
|
ユーザー |
|
提出日時 | 2017-03-13 00:37:59 |
言語 | Haskell (9.10.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 507 bytes |
コンパイル時間 | 6,879 ms |
コンパイル使用メモリ | 171,904 KB |
実行使用メモリ | 42,908 KB |
最終ジャッジ日時 | 2024-06-30 00:36:51 |
合計ジャッジ時間 | 13,596 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 2 |
other | AC * 14 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
ソースコード
-- yukicoder My practice -- author: Leonardone @ NEETSDKASU main = getContents >>= putStrLn . unwords . map show . solve . map read . words solve (n:xs) = baz n xs baz n xs = foldl (bar n) xs [1 .. 2 * n - 4] bar n xs i = foldl (\xs k -> foo k (i - k) xs) xs $ [k | k <- [0 .. i], k < i - k, k < n, i - k < n] foo p q as = bs where (xs2, (aq:xs1)) = splitAt q as (xs4, (ap:xs3)) = splitAt p xs2 bp = min ap aq bq = max ap aq bs = xs4 ++ [bp] ++ xs3 ++ [bq] ++ xs1