結果
| 問題 | No.182 新規性の虜 |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2026-05-06 00:47:31 |
| 言語 | Standard ML (MLton 20241230) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,191 bytes |
| 記録 | |
| コンパイル時間 | 2,546 ms |
| コンパイル使用メモリ | 704,828 KB |
| 実行使用メモリ | 82,520 KB |
| 最終ジャッジ日時 | 2026-05-06 00:48:20 |
| 合計ジャッジ時間 | 10,168 ms |
|
ジャッジサーバーID (参考情報) |
judge2_1 / judge1_0 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 21 TLE * 1 -- * 5 |
ソースコード
structure Bag =
struct
datatype tree = Leaf | Node of LargeInt.int * int * tree * tree
val empty = Leaf
fun size Leaf = 0
| size (Node (k, v, left, right)) = 1 + size left + size right
fun add Leaf newKey = Node (newKey, 1, Leaf, Leaf)
| add (Node (nodeKey, nodeValue, left, right)) newKey =
if nodeKey = newKey then (Node (nodeKey, nodeValue + 1, left, right))
else if nodeKey < newKey then Node (nodeKey, nodeValue, left, add right newKey)
else Node (nodeKey, nodeValue, add left newKey, right)
fun fromList l =
List.foldl (fn (x, acc) =>
add acc x)
empty
l
fun values Leaf = []
| values (Node (_, v, left, right)) = [v] @ values left @ values right
end
fun readInt () =
valOf (TextIO.scanStream (Int.scan StringCvt.DEC) TextIO.stdIn)
fun readLargeInt () =
valOf (TextIO.scanStream (LargeInt.scan StringCvt.DEC) TextIO.stdIn)
val () =
let
val n = readInt ()
val a_s = List.tabulate (n, fn _ => readLargeInt ())
val bag = Bag.fromList a_s
val ans = List.length (List.filter (fn v => v = 1) (Bag.values bag))
in
print (Int.toString ans ^ "\n")
end