結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 3 ms
9,164 KB
testcase_01 AC 3 ms
6,928 KB
testcase_02 AC 3 ms
7,280 KB
testcase_03 AC 3 ms
7,280 KB
testcase_04 AC 382 ms
14,612 KB
testcase_05 AC 382 ms
14,652 KB
testcase_06 AC 383 ms
14,584 KB
testcase_07 AC 382 ms
14,584 KB
testcase_08 AC 382 ms
14,692 KB
testcase_09 AC 382 ms
14,612 KB
testcase_10 AC 383 ms
14,504 KB
testcase_11 AC 382 ms
14,668 KB
testcase_12 AC 382 ms
14,552 KB
testcase_13 AC 382 ms
14,584 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

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