Created
December 22, 2015 07:52
-
-
Save autotaker/764a6d75741e2f807bc5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let rec read_ints acc = | |
let r = try Some (read_int()) with | |
End_of_file -> None in | |
match r with | |
Some(v) -> read_ints (v::acc) | |
| None -> List.rev acc | |
let output_ints = List.iter (fun v -> | |
print_int v; | |
print_newline()) | |
let main _ = | |
let ps = read_ints [] in | |
let start_t = Sys.time() in | |
Printf.fprintf stderr "length: %d\n" (List.length ps); | |
let qs = List.sort compare ps in | |
let end_t = Sys.time() in | |
Printf.fprintf stderr "Sorting: %.5fs\n" (end_t -. start_t); | |
output_ints qs;; | |
main();; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment