結果

問題 No.69 文字を自由に並び替え
ユーザー maimai8
提出日時 2020-08-03 15:31:24
言語 OCaml
(5.2.1)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 472 bytes
コンパイル時間 317 ms
コンパイル使用メモリ 21,576 KB
実行使用メモリ 5,248 KB
最終ジャッジ日時 2024-10-09 01:54:24
合計ジャッジ時間 993 ms
ジャッジサーバーID
(参考情報)
judge3 / judge2
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

let () =
  let rec charlist_of_string str n i = 
    if i = n then [] else str.[i] :: charlist_of_string str n (i+1) in
  Scanf.scanf "%s\n%s\n" @@ fun a b ->
  let arr = List.fast_sort compare (charlist_of_string a (String.length a) 0) in
  let brr = List.fast_sort compare (charlist_of_string b (String.length b) 0) in
  let ans = List.fold_left2 
    (fun a x y -> if x = y then a && true else false) true arr brr in
  Printf.printf "%s\n" (if ans then "YES" else "NO")
0