結果
問題 |
No.45 回転寿司
|
ユーザー |
![]() |
提出日時 | 2019-03-01 14:39:20 |
言語 | OCaml (5.2.1) |
結果 |
MLE
|
実行時間 | - |
コード長 | 532 bytes |
コンパイル時間 | 204 ms |
コンパイル使用メモリ | 19,584 KB |
実行使用メモリ | 821,540 KB |
最終ジャッジ日時 | 2024-10-09 00:35:07 |
合計ジャッジ時間 | 12,197 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 4 |
other | MLE * 1 -- * 29 |
ソースコード
let rec range a b = if a >= b then [] else a::(range (a+1) b) let rec solve acc count ls = match ls with | [] -> count::acc | n1::[] -> (count + n1)::acc | n1::n2::ns -> let acc' = solve acc (n1 + count) ns in solve acc' (n2 + count) (if List.length ns > 0 then List.tl ns else []) let _ = let _ = int_of_string @@ read_line() in let inputs = String.split_on_char ' ' (read_line ()) in solve [] 0 (List.map (fun i -> int_of_string i) inputs) |> List.fold_left (fun acc v -> max acc v) (-1) |> print_int