結果

問題 No.490 yukiソート
ユーザー LeonardoneLeonardone
提出日時 2017-03-11 00:05:42
言語 Haskell
(9.8.2)
結果
WA  
実行時間 -
コード長 404 bytes
コンパイル時間 10,361 ms
コンパイル使用メモリ 161,580 KB
実行使用メモリ 11,620 KB
最終ジャッジ日時 2023-09-06 16:07:45
合計ジャッジ時間 9,057 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,092 KB
testcase_01 WA -
testcase_02 AC 2 ms
7,136 KB
testcase_03 AC 2 ms
7,080 KB
testcase_04 AC 5 ms
9,624 KB
testcase_05 AC 5 ms
9,736 KB
testcase_06 AC 5 ms
9,632 KB
testcase_07 AC 5 ms
9,724 KB
testcase_08 AC 5 ms
9,636 KB
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 2 ms
7,128 KB
testcase_25 AC 3 ms
7,076 KB
testcase_26 WA -
testcase_27 AC 3 ms
7,060 KB
testcase_28 AC 2 ms
7,060 KB
testcase_29 WA -
testcase_30 AC 2 ms
7,072 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 #

-- 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