Submission #110882


Source Code Expand

let (|>) x f = f x ;;
let (@@) f x = f x ;;

let ident x = x ;;
let ident2 x y = (x, y) ;;
let ident3 x y z = (x, y, z) ;;
let ident4 x y z w = (x, y, z, w) ;;
let ident5 x y z w v = (x, y, z, w, v) ;;

let char_to_int x = int_of_char x - int_of_char '0' ;;
let int_to_char x = char_of_int (x + int_of_char '0') ;;

module List = struct
  include ListLabels ;;

  let rec iteri i f = function
    | [] -> ()
    | a::l -> f i a; iteri (i + 1) f l

  let iteri ~f l = iteri 0 f l
end
;;

module Array = struct
  include ArrayLabels ;;

  let reduce ~f xs =
    let acc = ref xs.(0) in
    for i = 1 to length xs - 1 do
      acc := f !acc xs.(i)
    done;
    !acc
  ;;
end
;;

module String = struct
  include StringLabels ;;

  let map_to_list ~f ss =
    let res = ref [] in
    iter ss ~f:(fun c -> res := f c :: !res);
    List.rev !res
  ;;

  let of_char_list ss =
    let res = String.create @@ List.length ss in
    List.iteri ss ~f:(fun i c -> res.[i] <- c);
    res
  ;;

  let iteri ~f a =
    for i = 0 to length a - 1 do f i (unsafe_get a i) done
  ;;
end
;;

module Float = struct
  let (+) = (+.)
  let (-) = (-.)
  let ( * ) = ( *. )
  let (/) = (/.)
end
;;

module Int64 = struct
  include Int64
  let (+) = add
  let (-) = sub
  let ( * ) = mul
  let (/) = div
end
;;

let fold_for ?(skip=1) min max ~init ~f =
  let acc = ref init in
  let cur = ref min in
  while !cur < max do
    acc := f !acc !cur;
    cur := !cur + skip;
  done;
  !acc
;;

let iter_for ?(skip=1) min max ~f =
  let cur = ref min in
  while !cur < max do
    f !cur;
    cur := !cur + skip;
  done
;;



let () =
  let x, y = Scanf.scanf "%d %d " ident2 in
  Printf.printf "%d\n" @@ max x y
;;

Submission Info

Submission Time
Task A - 正直者
User iab
Language OCaml (3.12.1)
Score 100
Code Size 1783 Byte
Status AC
Exec Time 56 ms
Memory 1184 KB

Judge Result

Set Name all
Score / Max Score 100 / 100
Status
AC × 27
Set Name Test Cases
all 00_sample_01.txt, 00_sample_02.txt, kensho_diff01, kensho_diff02, kensho_diff03, kensho_diff04, kensho_diff05, kensho_min-max01, kensho_min-max02, kensho_min-max03, kensho_min-max04, kensho_min-max05, kensho_min-max06, kensho_min-max07, kensho_min-max08, kensho_min-max09, kensho_min-max10, kensho_rand01, kensho_rand02, kensho_rand03, kensho_rand04, kensho_rand05, kensho_rand06, kensho_rand07, kensho_rand08, kensho_rand09, kensho_rand10
Case Name Status Exec Time Memory
00_sample_01.txt AC 56 ms 1028 KB
00_sample_02.txt AC 28 ms 1024 KB
kensho_diff01 AC 26 ms 1160 KB
kensho_diff02 AC 27 ms 1148 KB
kensho_diff03 AC 26 ms 1180 KB
kensho_diff04 AC 40 ms 1072 KB
kensho_diff05 AC 26 ms 1028 KB
kensho_min-max01 AC 26 ms 1036 KB
kensho_min-max02 AC 27 ms 1148 KB
kensho_min-max03 AC 27 ms 1140 KB
kensho_min-max04 AC 27 ms 1072 KB
kensho_min-max05 AC 26 ms 1028 KB
kensho_min-max06 AC 27 ms 1028 KB
kensho_min-max07 AC 27 ms 1156 KB
kensho_min-max08 AC 28 ms 1028 KB
kensho_min-max09 AC 32 ms 1028 KB
kensho_min-max10 AC 26 ms 1032 KB
kensho_rand01 AC 25 ms 1056 KB
kensho_rand02 AC 26 ms 1048 KB
kensho_rand03 AC 28 ms 1148 KB
kensho_rand04 AC 26 ms 1028 KB
kensho_rand05 AC 27 ms 1156 KB
kensho_rand06 AC 28 ms 1180 KB
kensho_rand07 AC 28 ms 1056 KB
kensho_rand08 AC 27 ms 1184 KB
kensho_rand09 AC 26 ms 1028 KB
kensho_rand10 AC 26 ms 1028 KB