Codeforces Round 662 Question C

#include <bits/stdc++.h>
using namespace std;
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
// #pragma GCC optimize "trapv"
#define lld long long int 

int main() {
	// your code goes here
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    lld t;
    cin>>t;
    while(t--)
    {
        int n,cnt=0,x;
        cin>>n;
        map <int,int> mp;
        
        for(int i=0;i<n;i++)
        {
            cin>>x;
            mp[x]++;
            cnt=max(cnt,mp[x]);
        }
        int d=mp.size()-1;
        int ans=min(d,(n-cnt)/(cnt-1));
        cout<<ans<<"\n";
    }
}

For which test case this is failing?
@galencolin @everule1 @akshitm16

1
9
1 2 3 4 1 2 5 1 2 

(conveniently, I’ve ordered them optimally already)

2 Likes