結果

問題 No.547 未知の言語
ユーザー derui
提出日時 2017-08-20 10:14:17
言語 OCaml
(5.2.1)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 565 bytes
コンパイル時間 382 ms
コンパイル使用メモリ 19,564 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-09 00:27:23
合計ジャッジ時間 1,545 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 33
権限があれば一括ダウンロードができます

ソースコード

diff #

let split_word str =
  let regexp = Str.regexp " " in
  Str.split regexp str

let compare_words s t =
  let ret = ref (0, "", "") in 
  List.combine s t
  |> List.iteri (fun index (s, t) ->
         if s <> t then ret := (index, s, t) else ()
       );
  !ret


let () =
  let _ = read_line () |> int_of_string in
  let s_words = read_line () |> split_word in
  let t_words = read_line () |> split_word in

  let index, s_diff, t_diff = compare_words s_words t_words in
  string_of_int (succ index) |> print_endline;
  print_endline s_diff;
  print_endline t_diff;
0