結果

問題 No.69 文字を自由に並び替え
ユーザー maimai8maimai8
提出日時 2020-08-03 15:31:24
言語 OCaml
(5.1.0)
結果
AC  
実行時間 2 ms / 5,000 ms
コード長 472 bytes
コンパイル時間 254 ms
コンパイル使用メモリ 21,448 KB
実行使用メモリ 5,376 KB
最終ジャッジ日時 2024-04-17 09:08:13
合計ジャッジ時間 879 ms
ジャッジサーバーID
(参考情報)
judge1 / judge4
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
5,248 KB
testcase_01 AC 2 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 2 ms
5,376 KB
testcase_04 AC 2 ms
5,376 KB
testcase_05 AC 2 ms
5,376 KB
testcase_06 AC 2 ms
5,376 KB
testcase_07 AC 2 ms
5,376 KB
testcase_08 AC 2 ms
5,376 KB
testcase_09 AC 2 ms
5,376 KB
testcase_10 AC 2 ms
5,376 KB
testcase_11 AC 2 ms
5,376 KB
testcase_12 AC 2 ms
5,376 KB
testcase_13 AC 2 ms
5,376 KB
testcase_14 AC 2 ms
5,376 KB
権限があれば一括ダウンロードができます

ソースコード

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