結果
問題 | No.2334 Distinct Cards |
ユーザー |
|
提出日時 | 2024-07-18 12:31:10 |
言語 | Rust (1.83.0 + proconio) |
結果 |
WA
|
実行時間 | - |
コード長 | 433 bytes |
コンパイル時間 | 21,175 ms |
コンパイル使用メモリ | 397,948 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-07-18 12:31:34 |
合計ジャッジ時間 | 19,881 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 8 WA * 14 |
ソースコード
use std::{collections::BTreeMap, io::Read};fn main() {let mut s = String::new();std::io::stdin().read_to_string(&mut s).ok();let n: Vec<u64> = s.split_whitespace().flat_map(str::parse).collect();let mut h = BTreeMap::new();let (mut a, mut c) = (1, 0);for &i in n[2..].iter() {*h.entry(i).or_insert(0) += 1;}for (_, &d) in h.iter().rev() {c += d;if c >= n[1] {break;}a += 1;}println!("{a}")}