Source Code
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define fi first
#define se second
void MOUST(){
    ios_base::sync_with_stdio(0);
           cin.tie(0);
}
int main(){
    MOUST();

    int q;cin>>q;
    while(q--){
        ll n,k=0,p=0;cin>>n;
        ll a[n];
        for(int i=0;i<n;i++){
            cin>>a[i];
            p=max(p,a[i]);
        }
        for(int i=0;i<n;i++)
            if(a[i]==p)
                k++;
        if(k==n)
            cout<<-1<<"\n";
        else
            cout<<n-k+1<<"\n";
    }
}
Copy
Proud Competitors call911kid
GNU G++17
5 ms
312 KB
Wrong Answer