結果
| 問題 | No.2334 Distinct Cards |
| コンテスト | |
| ユーザー |
EvbCFfp1XB
|
| 提出日時 | 2023-06-02 22:54:28 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 454 bytes |
| 記録 | |
| コンパイル時間 | 22,607 ms |
| コンパイル使用メモリ | 401,924 KB |
| 実行使用メモリ | 6,820 KB |
| 最終ジャッジ日時 | 2024-12-28 21:13:02 |
| 合計ジャッジ時間 | 19,961 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 2 |
| other | AC * 9 WA * 13 |
ソースコード
use proconio::input;
fn main() {
input! {
n: usize,
k: usize,
a: [usize; n],
}
let mut counts = vec![0; n + 1];
(0..n).for_each(|i| counts[a[i]] += 1);
counts.sort_by(|a, b| b.cmp(a));
let mut position = 0;
let mut sum = 0;
for i in 0..n + 1 {
sum += counts[position];
if sum >= k {
position = i + 1;
break;
}
}
println!("{}", position);
}
EvbCFfp1XB