結果
| 問題 | No.2559 眩しい数直線 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-03-29 00:27:40 |
| 言語 | Standard ML (MLton 20241230) |
| 結果 |
AC
|
| 実行時間 | 5 ms / 2,000 ms |
| コード長 | 1,176 bytes |
| 記録 | |
| コンパイル時間 | 6,767 ms |
| コンパイル使用メモリ | 704,392 KB |
| 実行使用メモリ | 7,844 KB |
| 最終ジャッジ日時 | 2026-03-29 00:27:48 |
| 合計ジャッジ時間 | 6,205 ms |
|
ジャッジサーバーID (参考情報) |
judge1_1 / judge3_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 20 |
ソースコード
fun readInt () =
valOf (TextIO.scanStream (Int.scan StringCvt.DEC) TextIO.stdIn)
fun buildTable [] table = ignore ()
| buildTable ((a, b) :: tl) table =
(
Array.appi (fn (i, v) =>
let
val thisV = Int.max(b - abs(i - a), 0)
val newV = Int.max(thisV, v)
in
Array.update (table, i, newV)
end)
table;
buildTable tl table
)
fun printTable right table =
Array.appi (fn (i, v) =>
if i = 0 then ignore ()
else
(
print (Int.toString v);
if i = right
then print "\n"
else print " "
)
)
table
val () =
let
val n = readInt ()
val x = readInt ()
val ab_s = List.tabulate (n, fn _ => (readInt (), readInt()))
val table = Array.array (x + 1, 0)
in
(
buildTable ab_s table;
printTable x table
)
end