結果

問題 No.490 yukiソート
ユーザー LeonardoneLeonardone
提出日時 2017-03-13 00:41:19
言語 Haskell
(9.8.2)
結果
TLE  
実行時間 -
コード長 536 bytes
コンパイル時間 11,218 ms
コンパイル使用メモリ 164,444 KB
実行使用メモリ 14,712 KB
最終ジャッジ日時 2023-09-12 12:12:09
合計ジャッジ時間 20,672 ms
ジャッジサーバーID
(参考情報)
judge11 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
7,036 KB
testcase_01 AC 2 ms
7,064 KB
testcase_02 AC 3 ms
7,204 KB
testcase_03 AC 3 ms
7,204 KB
testcase_04 AC 382 ms
14,712 KB
testcase_05 AC 382 ms
14,664 KB
testcase_06 AC 382 ms
14,604 KB
testcase_07 AC 382 ms
14,688 KB
testcase_08 AC 382 ms
14,672 KB
testcase_09 AC 383 ms
14,572 KB
testcase_10 AC 382 ms
14,632 KB
testcase_11 AC 382 ms
14,676 KB
testcase_12 AC 382 ms
14,676 KB
testcase_13 AC 382 ms
14,644 KB
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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 #

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