Source Code
#include <bits/stdc++.h>

using namespace std;
#define pb push_back
typedef long long ll;



int main(){

	int T,n,k, t,a,b;
       cin>>T;
    while(T--){
        cin>>n;
        vector<int>v;
       for(t=0;t<n;t++){
        cin>>a;
        v.pb(a);
       }

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

       for(t=0;t<n;t++)
        if(v[t]==v[0])
        cout<<v[0]<<" ";
       else break;
       cout<<"\n";
    }

}
Copy
To-do List mohammed_mraish
GNU G++17
270 ms
1.6 MB
Accepted