結果
| 問題 | No.2194 兄弟の掛け引き |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-03-07 07:46:46 |
| 言語 | Standard ML (MLton 20241230) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 1,094 bytes |
| 記録 | |
| コンパイル時間 | 2,316 ms |
| コンパイル使用メモリ | 705,044 KB |
| 実行使用メモリ | 7,848 KB |
| 最終ジャッジ日時 | 2026-03-07 07:46:52 |
| 合計ジャッジ時間 | 3,134 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 12 WA * 2 |
ソースコード
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 readInt () =
valOf (TextIO.scanStream (Int.scan StringCvt.DEC) TextIO.stdIn)
fun intString n =
if 0 <= n
then Int.toString n
else "-" ^ Int.toString (abs n)
fun printList [] = ignore ()
| printList (h :: tl) =
(
print (intString h);
print "\n";
printList tl
)
val () =
let
val a = readInt ()
val b = readInt ()
val c = readInt ()
val candidates = [(c + b) div a, c div a]
val filtered = List.filter (fn n =>
n * a - b = c orelse n * a = c)
candidates
val ans = if filtered = [] then [~1]
else quicksort filtered
in
printList ans
end