結果
| 問題 | No.1130 Grid Numbers |
| ユーザー |
|
| 提出日時 | 2026-01-04 00:27:55 |
| 言語 | Standard ML (MLton 20210117) |
| 結果 |
AC
|
| 実行時間 | 1 ms / 2,000 ms |
| コード長 | 1,082 bytes |
| 記録 | |
| コンパイル時間 | 4,171 ms |
| コンパイル使用メモリ | 705,416 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2026-01-04 00:28:00 |
| 合計ジャッジ時間 | 4,798 ms |
|
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| other | AC * 12 |
ソースコード
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 printAns h w [] = ignore ()
| printAns h w l =
let
val taked = List.take (l, w)
val dropped = List.drop (l, w)
val asString = String.concatWith " " (List.map (fn a => Int.toString a) taked)
in
(
print (asString ^ "\n");
printAns h w dropped
)
end
val () =
let
val h = readInt ()
val w = readInt ()
val aMatrix = List.tabulate (h, fn _ =>
List.tabulate (w, fn _ => readInt()))
val a_s = List.concat aMatrix
val sorted = quicksort a_s
in
printAns h w sorted
end