結果
問題 | No.2334 Distinct Cards |
ユーザー |
|
提出日時 | 2024-11-30 17:06:18 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 14 ms / 2,000 ms |
コード長 | 622 bytes |
コンパイル時間 | 3,331 ms |
コンパイル使用メモリ | 254,756 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-11-30 17:06:23 |
合計ジャッジ時間 | 4,601 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 2 |
other | AC * 22 |
ソースコード
#ifndef LOCAL#include <bits/stdc++.h>using namespace std;#define debug(...) (void(0))#else#include "algo/debug.h"#endifvoid solve() {int N, K; cin >> N >> K;vector<int> A(N);vector<int> freq(N);for(int i = 0; i < N; i++) {cin >> A[i], A[i]--;freq[A[i]]++;}sort(freq.rbegin(), freq.rend());int sum = 0;int id = 0;while(sum < K) {sum += freq[id++];}cout << id << endl;}int main() {std::ios::sync_with_stdio(false);std::cin.tie(nullptr);int tt = 1;// std::cin >> tt;while(tt--) {solve();}}