結果
問題 |
No.406 鴨等間隔の法則
|
ユーザー |
|
提出日時 | 2025-10-01 00:25:35 |
言語 | Standard ML (MLton 20210117) |
結果 |
TLE
|
実行時間 | - |
コード長 | 1,010 bytes |
コンパイル時間 | 3,059 ms |
コンパイル使用メモリ | 687,352 KB |
実行使用メモリ | 46,440 KB |
最終ジャッジ日時 | 2025-10-01 00:25:45 |
合計ジャッジ時間 | 9,865 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 24 TLE * 1 -- * 4 |
コンパイルメッセージ
Warning: main.sml 28.13-28.24. Declaration is not exhaustive. missing pattern: :: (_, nil) | nil in: val h1 :: h2 :: tl = quicksort l
ソースコード
fun readInt () = valOf (TextIO.scanStream (Int.scan StringCvt.DEC) TextIO.stdIn) fun quicksort [] = [] | quicksort (h::tl) = let val (s, b) = List.foldl (fn (x, (small, big)) => if x <= h then (x::small, big) else (small, x::big)) ([], []) tl in (quicksort s) @ [h] @ (quicksort b) end fun isSatisfy l = let fun isSatisfyAux _ nil = true | isSatisfyAux _ [_] = true | isSatisfyAux diff (h1::h2::tl) = if h2 - h1 = diff then isSatisfyAux diff (h2::tl) else false val (h1::h2::tl) = quicksort l in if h2 - h1 = 0 then false else isSatisfyAux (h2 - h1) (h2::tl) end val () = let val n = readInt () val x_s = List.tabulate (n, fn _ => readInt ()) val ans = if isSatisfy x_s then "YES" else "NO" in print (ans ^ "\n") end