/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 324.0 KiB
#2 Wrong Answer 1ms 320.0 KiB
#3 Accepted 91ms 556.0 KiB
#4 Wrong Answer 78ms 1.602 MiB

Code

#include<bits/stdc++.h>
#define ll long long
using namespace std;

int main(){
  int t;
  cin >> t;
  while (t--){
    int n, k, ans = 0;
    cin >> n >> k;
    map<int, int> mp;
    vector<int> a(n), b;
    for (int i = 0; i < n; i++){
      cin >> a[i];
      mp[a[i]]++;
    }
    int x = (n + (k - 1)) / k;
    for (auto [f, s] : mp){
      b.push_back(s);
    }
    sort(b.rbegin(), b.rend());
    for (int i = 0; i < b.size() && i < k; i++){
      ans += b[i];
    }
    cout << n - ans << endl; //mx<<" "<<j<<endl;
  }
}

Information

Submit By
Type
Submission
Problem
P1062 Roy and Array
Contest
Brain Booster #4
Language
C++17 (G++ 13.2.0)
Submit At
2024-07-14 18:49:43
Judged At
2024-11-11 03:22:06
Judged By
Score
15
Total Time
91ms
Peak Memory
1.602 MiB