結果

問題 No.490 yukiソート
ユーザー Leonardone
提出日時 2017-03-11 00:05:42
言語 Haskell
(9.10.1)
結果
WA  
実行時間 -
コード長 404 bytes
コンパイル時間 8,411 ms
コンパイル使用メモリ 172,416 KB
実行使用メモリ 8,320 KB
最終ジャッジ日時 2024-06-24 10:33:27
合計ジャッジ時間 9,329 ms
ジャッジサーバーID
(参考情報)
judge2 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 11 WA * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
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

ソースコード

diff #

-- Try yukicoder
-- author: Leonardone @ NEETSDKASU

import Data.List(sort)

main = getContents >>= putStrLn . unwords . map show . solve . map read . words

solve (n:xs) 
    | even n = sort xs
    | otherwise = ans where
        m = n - 1
        d = n `div` 2
        ys = sort $ take m xs
        zs = sort $ take d ys ++ drop (d + 1) ys ++ drop m xs
        ans = take d zs ++ [ys !! d] ++ drop d zs
0