結果

問題 No.45 回転寿司
ユーザー regeregeregerege
提出日時 2015-10-12 20:55:45
言語 F#
(F# 4.0)
結果
WA  
実行時間 -
コード長 706 bytes
コンパイル時間 5,819 ms
コンパイル使用メモリ 192,744 KB
実行使用メモリ 37,328 KB
最終ジャッジ日時 2024-05-03 11:16:11
合計ジャッジ時間 17,553 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 WA -
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 303 ms
34,844 KB
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 AC 297 ms
34,824 KB
testcase_23 AC 305 ms
34,836 KB
testcase_24 AC 304 ms
34,852 KB
testcase_25 AC 295 ms
34,916 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 WA -
testcase_31 AC 311 ms
34,840 KB
testcase_32 AC 308 ms
34,848 KB
testcase_33 WA -
権限があれば一括ダウンロードができます
コンパイルメッセージ
  復元対象のプロジェクトを決定しています...
  /home/judge/data/code/main.fsproj を復元しました (200 ms)。
MSBuild のバージョン 17.9.6+a4ecab324 (.NET)
  main -> /home/judge/data/code/bin/Release/net8.0/main.dll
  main -> /home/judge/data/code/bin/Release/net8.0/publish/

ソースコード

diff #

    let calc = function
        | [a;_;c;d;] -> max (a+c) (a+d)
        | [a;_;c;] -> a+c
        | [a;_;] | [a] -> a
        | _ -> failwith "unattainable"
    let rec f3 l n =
        match List.length l with
        | 0 -> n
        | 1 -> n+l.[0]
        | _ ->
            let A = calc <| List.truncate 4 l
            let B = calc <| (List.skip 1 >> List.truncate 3) l
            let p = if A < B then 1 else 0
            let pp =
                if List.length l < (p+3) then List.length l
                else p+2
            f3 (List.skip (pp) l) (l.[p]+n)
    stdin.ReadLine() |> ignore
    let l = stdin.ReadLine().Split([|' '|]) |> Seq.map (int) |> Seq.toList
    f3 l 0
    |> (printfn "%d")
0