結果

問題 No.490 yukiソート
ユーザー ichibanshiboriichibanshibori
提出日時 2017-03-10 22:38:08
言語 F#
(F# 4.0)
結果
AC  
実行時間 207 ms / 2,000 ms
コード長 644 bytes
コンパイル時間 3,660 ms
コンパイル使用メモリ 157,312 KB
実行使用メモリ 25,176 KB
最終ジャッジ日時 2023-09-06 15:42:07
合計ジャッジ時間 9,292 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 79 ms
22,760 KB
testcase_01 AC 79 ms
22,740 KB
testcase_02 AC 80 ms
24,868 KB
testcase_03 AC 80 ms
22,876 KB
testcase_04 AC 90 ms
23,068 KB
testcase_05 AC 90 ms
23,004 KB
testcase_06 AC 91 ms
23,052 KB
testcase_07 AC 91 ms
23,208 KB
testcase_08 AC 90 ms
23,092 KB
testcase_09 AC 93 ms
23,000 KB
testcase_10 AC 91 ms
22,992 KB
testcase_11 AC 90 ms
23,160 KB
testcase_12 AC 90 ms
23,092 KB
testcase_13 AC 91 ms
25,096 KB
testcase_14 AC 207 ms
25,068 KB
testcase_15 AC 206 ms
23,180 KB
testcase_16 AC 207 ms
25,176 KB
testcase_17 AC 204 ms
23,248 KB
testcase_18 AC 205 ms
23,128 KB
testcase_19 AC 207 ms
25,100 KB
testcase_20 AC 205 ms
23,180 KB
testcase_21 AC 205 ms
23,316 KB
testcase_22 AC 204 ms
23,052 KB
testcase_23 AC 205 ms
23,408 KB
testcase_24 AC 81 ms
22,800 KB
testcase_25 AC 80 ms
22,856 KB
testcase_26 AC 80 ms
22,868 KB
testcase_27 AC 81 ms
22,812 KB
testcase_28 AC 80 ms
22,752 KB
testcase_29 AC 80 ms
22,884 KB
testcase_30 AC 82 ms
22,728 KB
testcase_31 AC 81 ms
22,780 KB
testcase_32 AC 83 ms
24,780 KB
testcase_33 AC 82 ms
24,876 KB
testcase_34 AC 82 ms
22,788 KB
testcase_35 AC 82 ms
22,840 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) F# Compiler version 11.0.0.0 for F# 5.0
Copyright (c) Microsoft Corporation. All Rights Reserved.

ソースコード

diff #

let solve n (a_arr: array<int>) =
    let rec solve' i =
        if i >= 2 * n - 3 then ()
        else
            seq {0..i}
            |> Seq.iter (fun p ->
                let q = i - p
                if 0 <= p && p < q && q <= n - 1 && a_arr.[p] > a_arr.[q] then
                    let t = a_arr.[p]
                    a_arr.[p] <- a_arr.[q]
                    a_arr.[q] <- t)
            solve' (i + 1)
    solve' 1
    a_arr

let () =
    let n = stdin.ReadLine() |> int
    let a_arr = stdin.ReadLine().Split()
                |> Array.map int

    solve n a_arr
    |> Array.map string
    |> String.concat " "
    |> printfn "%s"
0