Submission #123064
Source Code Expand
let rec parse str = let ls = ref [] in let pool = ref [] in let len = String.length str in for i = 0 to len - 1 do if str.[i] = ' ' then begin ls := (String.concat "" !pool) :: !ls; pool := [] end else begin let s = Char.escaped str.[i] in pool := !pool @ [s] end done; (String.concat "" !pool) :: !ls let take n list = let rec take' n list = if n = 0 then [] else match list with | [] -> failwith "take" | h::t -> h :: take' (n-1) t in take' n list let rec drop n list = if n = 0 then list else drop (n-1) (List.tl list) let max i j = if i > j then i else j let rec get_score list ori n c cnt = if n = 0 then c else match list with | h::[] -> let ori = take cnt ori in get_score ori ori (n-1) ((c +. h) /. 2.) 0 | h::t -> let new_ori = (take cnt ori) @ (drop (cnt+1) ori) in max (get_score new_ori new_ori (n-1) ((c +. h) /. 2.) 0) (get_score t ori n c (cnt+1)) | _ -> failwith "" let main () = let (n,k) = Scanf.scanf "%d %d" (fun i j -> (i,j)) in let rate_str = read_line () in let rate_list = List.map float_of_string (parse rate_str) in let score = get_score rate_list rate_list k 0.0 0 in print_float score; print_endline "" let _ = main ()
Submission Info
Submission Time | |
---|---|
Task | C - AtCoderプログラミング講座 |
User | no_maddo |
Language | OCaml (3.12.1) |
Score | 0 |
Code Size | 1397 Byte |
Status | RE |
Exec Time | 28 ms |
Memory | 1188 KB |
Judge Result
Set Name | All | ||
---|---|---|---|
Score / Max Score | 0 / 100 | ||
Status |
|
Set Name | Test Cases |
---|---|
All | 00_sample_01.txt, 00_sample_02.txt, 00_sample_03.txt, 00_sample_04.txt, test_01.txt, test_02.txt, test_03.txt, test_04.txt, test_05.txt, test_06.txt, test_07.txt, test_08.txt, test_09.txt, test_10.txt, test_11.txt, test_12.txt, test_13.txt, test_14.txt, test_15.txt, test_16.txt, test_17.txt, test_18.txt, test_19.txt, test_20.txt, test_21.txt, test_22.txt, test_23.txt, test_24.txt, test_25.txt, test_26.txt, test_27.txt, test_28.txt, test_29.txt, test_30.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_sample_01.txt | RE | 28 ms | 1092 KB |
00_sample_02.txt | RE | 25 ms | 1140 KB |
00_sample_03.txt | RE | 26 ms | 1084 KB |
00_sample_04.txt | RE | 24 ms | 1088 KB |
test_01.txt | RE | 24 ms | 1180 KB |
test_02.txt | RE | 25 ms | 1088 KB |
test_03.txt | RE | 26 ms | 1068 KB |
test_04.txt | RE | 25 ms | 1088 KB |
test_05.txt | RE | 25 ms | 1184 KB |
test_06.txt | RE | 26 ms | 1092 KB |
test_07.txt | RE | 25 ms | 1084 KB |
test_08.txt | RE | 25 ms | 1172 KB |
test_09.txt | RE | 26 ms | 1088 KB |
test_10.txt | RE | 27 ms | 1088 KB |
test_11.txt | RE | 25 ms | 1084 KB |
test_12.txt | RE | 26 ms | 1084 KB |
test_13.txt | RE | 27 ms | 1088 KB |
test_14.txt | RE | 26 ms | 1116 KB |
test_15.txt | RE | 25 ms | 1084 KB |
test_16.txt | RE | 25 ms | 1188 KB |
test_17.txt | RE | 25 ms | 1084 KB |
test_18.txt | RE | 25 ms | 1080 KB |
test_19.txt | RE | 26 ms | 1184 KB |
test_20.txt | RE | 26 ms | 1080 KB |
test_21.txt | RE | 25 ms | 1088 KB |
test_22.txt | RE | 25 ms | 1084 KB |
test_23.txt | RE | 25 ms | 1184 KB |
test_24.txt | RE | 26 ms | 1136 KB |
test_25.txt | RE | 25 ms | 1080 KB |
test_26.txt | RE | 25 ms | 1056 KB |
test_27.txt | RE | 25 ms | 1088 KB |
test_28.txt | RE | 28 ms | 1180 KB |
test_29.txt | RE | 25 ms | 1180 KB |
test_30.txt | RE | 25 ms | 1088 KB |