結果

問題 No.69 文字を自由に並び替え
ユーザー tanson
提出日時 2025-08-01 02:18:04
言語 Standard ML
(MLton 20210117)
結果
AC  
実行時間 1 ms / 5,000 ms
コード長 580 bytes
コンパイル時間 2,644 ms
コンパイル使用メモリ 689,912 KB
実行使用メモリ 7,716 KB
最終ジャッジ日時 2025-08-01 02:18:10
合計ジャッジ時間 3,720 ms
ジャッジサーバーID
(参考情報)
judge4 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 15
権限があれば一括ダウンロードができます

ソースコード

diff #

fun readStr () =
    valOf (TextIO.inputLine TextIO.stdIn)

fun insertionSort l =
    let
        fun insert x [] = [x]
          | insert x (y::ys) = if x <= y then x::y::ys
                               else y::(insert x ys)
    in
        foldl (fn (x, acc) => insert x acc) [] l
    end

val () =
    let
        val a = readStr ()
        val b = readStr ()
        val sortedA = (insertionSort o explode) a
        val sortedB = (insertionSort o explode) b

        val ans = if sortedA = sortedB then "YES\n"
                  else "NO\n"
    in
        print ans
    end
0