結果
| 問題 | No.998 Four Integers |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2025-12-21 23:17:53 |
| 言語 | Standard ML (MLton 20210117) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 1,000 ms |
| コード長 | 873 bytes |
| 記録 | |
| コンパイル時間 | 2,612 ms |
| コンパイル使用メモリ | 689,656 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2025-12-21 23:17:59 |
| 合計ジャッジ時間 | 3,681 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 23 |
ソースコード
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 isContinuous [] = true
| isContinuous [_] = true
| isContinuous (h1 :: h2 :: tl) =
if h1 + 1 = h2 then isContinuous (h2 :: tl)
else false
val () =
let
val a = readInt ()
val b = readInt ()
val c = readInt ()
val d = readInt ()
val sorted = quicksort [a, b, c, d]
val ans = if isContinuous sorted then "Yes"
else "No"
in
print (ans ^ "\n")
end