Submission #1680307


Source Code Expand

let () =
  let n = Scanf.scanf "%d\n" (fun n -> n) in
  let as_ = Array.init n (fun _ -> Scanf.scanf "%d\n" (fun a -> a)) in
  Array.to_list as_
  |> (fun (a :: as_) -> List.fold_left (fun (acc, prev) a ->
      (acc + min prev a + (prev - min prev a) / 2, a - min prev a)) (0, a) as_)
  |> fst
  |> Printf.printf "%d\n"

Submission Info

Submission Time
Task A - Wanna go back home
User fetburner
Language OCaml (4.02.3)
Score 0
Code Size 327 Byte
Status RE
Exec Time 1 ms
Memory 384 KB

Compile Error

File "./Main.ml", line 5, characters 5-141:
Warning 8: this pattern-matching is not exhaustive.
Here is an example of a value that is not matched:
[]

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 200
Status
RE × 4
RE × 15
Set Name Test Cases
Sample s1.txt, s2.txt, s3.txt, s4.txt
All 01.txt, 04.txt, 05.txt, 06.txt, 07.txt, 08.txt, 09.txt, 10.txt, 11.txt, 13.txt, 15.txt, s1.txt, s2.txt, s3.txt, s4.txt
Case Name Status Exec Time Memory
01.txt RE 1 ms 384 KB
04.txt RE 1 ms 384 KB
05.txt RE 1 ms 384 KB
06.txt RE 1 ms 384 KB
07.txt RE 1 ms 384 KB
08.txt RE 1 ms 384 KB
09.txt RE 1 ms 384 KB
10.txt RE 1 ms 384 KB
11.txt RE 1 ms 384 KB
13.txt RE 1 ms 384 KB
15.txt RE 1 ms 384 KB
s1.txt RE 1 ms 384 KB
s2.txt RE 1 ms 384 KB
s3.txt RE 1 ms 384 KB
s4.txt RE 1 ms 384 KB