Please subscribe to the official Codeforces channel in Telegram via the link https://t.me/codeforces_official. ×

What is wrong with this solution??!

Revision en1, by animesh-94, 2024-07-23 16:43:41

include

include<bits/stdc++.h>

include

include

using namespace std;

int main(){ int t; cin>>t;

while(t--){
    int n;
    cin>>n;

    vector<int> a(n);

    for(int i=0; i<n; i++){
        cin>>a[i];
    }

    sort(a.rbegin(), a.rend());

    int mx = 0;
    for(int i=0; i<n; i++){
        if(a[i] > mx){
            mx = a[i];
            a[i]=0;
        }
        else{
            break;
        }
    }

    bool alice = false;
    for(int i=0; i<n; i++){
        if(a[i] != 0){
            alice = true;
            break;
        }
    }

    if(alice){
        cout<<"YES"<<endl;
    }
    else{
        cout<<"NO"<<endl;
    }
}
return 0;

}

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English animesh-94 2024-07-23 16:43:41 910 The problem is from codeforces 960 div(1+2) and i cannot figure out the proper solution to the specified question (published)