Submission #1867589
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 :: xs -> try let x1 = List.hd xs in (min x0 x1) :: (iter xs) with | _ -> [x0] 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 | 1098 Byte |
Status | TLE |
Exec Time | 2657 ms |
Memory | 28280 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 | 2656 ms | 26996 KB |
subtask0_1.txt | TLE | 2657 ms | 24736 KB |
subtask0_10.txt | TLE | 2657 ms | 23524 KB |
subtask0_11.txt | TLE | 2657 ms | 24608 KB |
subtask0_12.txt | TLE | 2657 ms | 24284 KB |
subtask0_13.txt | TLE | 2657 ms | 24352 KB |
subtask0_14.txt | TLE | 2657 ms | 25588 KB |
subtask0_2.txt | TLE | 2657 ms | 22240 KB |
subtask0_3.txt | TLE | 2657 ms | 23580 KB |
subtask0_4.txt | TLE | 2657 ms | 24608 KB |
subtask0_5.txt | TLE | 2657 ms | 22184 KB |
subtask0_6.txt | TLE | 2657 ms | 23156 KB |
subtask0_7.txt | TLE | 2656 ms | 22244 KB |
subtask0_8.txt | TLE | 2656 ms | 26344 KB |
subtask0_9.txt | TLE | 2656 ms | 28280 KB |