Submission #229341
Source Code Expand
let pf = Printf.printf ;; let epf = Printf.eprintf ;; let sf = Scanf.scanf ;; let (|>) x f = f x ;; let (@@) f x = f x ;; module Array = struct include ArrayLabels let foldi ~f ~init arr = let acc = ref init in for i = 0 to Array.length arr - 1 do acc := f i !acc arr.(i) done; !acc ;; let findi arr ~f = let len = Array.length arr in let rec iter i = if i = len then None else if f arr.(i) then Some i else iter (i + 1) in iter 0 ;; let findi_exn arr ~f = let len = Array.length arr in let rec iter i = if i = len then None else if f arr.(i) then Some i else iter (i + 1) in iter 0 ;; (* i ∈ [0..res) -> not (f i) /\ i ∈ [res, len) -> f i *) let lower_bound arr ~f = let l, h = 0, Array.length arr in (* res ∈ (l, h] *) let rec iter l h = if l = h - 1 then h else let m = (l + h) lsr 1 in if f m then iter l m else iter m h in iter l h ;; (* i ∈ [0..res] -> f i /\ i ∈ (res, len) -> not (f i) *) let upper_bound arr ~f = let l, h = 0, Array.length arr in (* res ∈ [l, h) *) let rec iter l h = if l = h - 1 then l else let m = (l + h) lsr 1 in if f m then iter m h else iter l m in iter l h ;; end module String = StringLabels ;; module List = struct include ListLabels ;; let rec repeat n a = if n = 0 then [] else a :: repeat (n - 1) a ;; let rec drop n a = if n = 0 then a else match a with | [] -> failwith "cannot take" | x :: xs -> drop (n - 1) xs ;; let init ~f n = let res = ref [] in for i = 0 to n - 1 do res := f i :: !res done; List.rev !res ;; end ;; module H = Hashtbl ;; module SI = Set.Make (struct type t = int let compare = compare end) let () = sf "%d %d " (fun a b -> pf "%d\n" @@ if a mod b = 0 then 0 else b - a mod b) ;;
Submission Info
Submission Time | |
---|---|
Task | A - けんしょう先生のお菓子配り |
User | iab |
Language | OCaml (3.12.1) |
Score | 100 |
Code Size | 2041 Byte |
Status | AC |
Exec Time | 31 ms |
Memory | 1180 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 100 / 100 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | subtask0_sample01.txt, subtask0_sample02.txt, subtask0_sample03.txt, subtask0_sample04.txt |
All | subtask0_sample01.txt, subtask0_sample02.txt, subtask0_sample03.txt, subtask0_sample04.txt, subtask1_01.txt, subtask1_02.txt, subtask1_03.txt, subtask1_04.txt, subtask1_05.txt, subtask1_06.txt, subtask1_07.txt, subtask1_08.txt, subtask1_09.txt, subtask1_10.txt, subtask1_11.txt, subtask1_12.txt, subtask1_13.txt, subtask1_14.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
subtask0_sample01.txt | AC | 30 ms | 1132 KB |
subtask0_sample02.txt | AC | 27 ms | 1180 KB |
subtask0_sample03.txt | AC | 28 ms | 1152 KB |
subtask0_sample04.txt | AC | 28 ms | 1180 KB |
subtask1_01.txt | AC | 27 ms | 1048 KB |
subtask1_02.txt | AC | 31 ms | 1056 KB |
subtask1_03.txt | AC | 28 ms | 1148 KB |
subtask1_04.txt | AC | 27 ms | 1152 KB |
subtask1_05.txt | AC | 29 ms | 1152 KB |
subtask1_06.txt | AC | 28 ms | 1176 KB |
subtask1_07.txt | AC | 30 ms | 1152 KB |
subtask1_08.txt | AC | 29 ms | 1024 KB |
subtask1_09.txt | AC | 29 ms | 1176 KB |
subtask1_10.txt | AC | 29 ms | 1176 KB |
subtask1_11.txt | AC | 29 ms | 1148 KB |
subtask1_12.txt | AC | 27 ms | 1152 KB |
subtask1_13.txt | AC | 29 ms | 1144 KB |
subtask1_14.txt | AC | 28 ms | 1148 KB |