結果
問題 |
No.490 yukiソート
|
ユーザー |
|
提出日時 | 2017-03-13 00:41:19 |
言語 | Haskell (9.10.1) |
結果 |
TLE
|
実行時間 | - |
コード長 | 536 bytes |
コンパイル時間 | 8,542 ms |
コンパイル使用メモリ | 174,720 KB |
実行使用メモリ | 42,400 KB |
最終ジャッジ日時 | 2024-06-30 00:37:10 |
合計ジャッジ時間 | 7,994 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
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 import Data.List (foldl') 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