Submission #1867577
Source Code Expand
(* split a string [s] at every char [c], and return the list of sub-strings *) let split s c = let len = String.length s in let rec iter pos to_rev = if pos = len then List.rev ("" :: to_rev) else match try Some ( String.index_from s pos c ) with Not_found -> None with Some pos2 -> if pos2 = pos then iter (pos+1) ("" :: to_rev) else iter (pos2+1) ((String.sub s pos (pos2-pos)) :: to_rev) | None -> List.rev ( String.sub s pos (len-pos) :: to_rev ) in iter 0 [];; let concat ls = List.fold_left (fun x y -> x ^ y) "" ls;; let calc ks = let rec iter ks = match ks with | [] -> [] | x0 :: [] -> [x0] | x0 :: x1 :: xs -> (min x0 x1) :: (iter (x1 :: xs)) in match ks with | [] -> [] | x :: _ -> iter (x :: ks);; let n = int_of_string (input_line stdin);; let ks = List.map int_of_string (split (input_line stdin) ' ');; calc ks |> List.map (fun x -> (string_of_int x) ^ " ") |> concat |> print_endline;;
Submission Info
Submission Time | |
---|---|
Task | B - 積み鉛筆 |
User | tzskp1 |
Language | OCaml (4.02.3) |
Score | 0 |
Code Size | 1058 Byte |
Status | TLE |
Exec Time | 2657 ms |
Memory | 25104 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 80 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample1.txt, sample2.txt, sample3.txt |
All | sample1.txt, sample2.txt, sample3.txt, subtask0_0.txt, subtask0_1.txt, subtask0_10.txt, subtask0_11.txt, subtask0_12.txt, subtask0_13.txt, subtask0_14.txt, subtask0_2.txt, subtask0_3.txt, subtask0_4.txt, subtask0_5.txt, subtask0_6.txt, subtask0_7.txt, subtask0_8.txt, subtask0_9.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
sample1.txt | AC | 1 ms | 384 KB |
sample2.txt | AC | 1 ms | 384 KB |
sample3.txt | AC | 1 ms | 384 KB |
subtask0_0.txt | TLE | 2657 ms | 23508 KB |
subtask0_1.txt | TLE | 2657 ms | 23668 KB |
subtask0_10.txt | TLE | 2657 ms | 22200 KB |
subtask0_11.txt | TLE | 2657 ms | 23072 KB |
subtask0_12.txt | TLE | 2657 ms | 22812 KB |
subtask0_13.txt | TLE | 2657 ms | 23072 KB |
subtask0_14.txt | TLE | 2657 ms | 24052 KB |
subtask0_2.txt | TLE | 2657 ms | 20780 KB |
subtask0_3.txt | TLE | 2657 ms | 22092 KB |
subtask0_4.txt | TLE | 2657 ms | 23072 KB |
subtask0_5.txt | TLE | 2657 ms | 21096 KB |
subtask0_6.txt | TLE | 2657 ms | 22092 KB |
subtask0_7.txt | TLE | 2657 ms | 20652 KB |
subtask0_8.txt | TLE | 2656 ms | 25104 KB |
subtask0_9.txt | TLE | 2656 ms | 25012 KB |