Source Code
#include <bits/stdc++.h>
using namespace std;

#define endl "\n"
#define IOS ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

typedef long long int ll;

ll mod=1e9+7;
ll a[300010];
ll c[300010];

ll tc,i,j,k,n,m;
string s,s1,s2;

map<ll,ll> mp;
vector<ll> v;
int main(){
    //IOS

    cin>>tc;
    while(tc--){
            cin>>n;

            ll mx=-1;
            for(i=0;i<n;i++){
                cin>>a[i];
                mx=max(a[i],mx);

            }

            for(i=0;i<n;i++)
                if(a[i]==mx)
                cout<<a[i]<<' ';

                cout<<endl;
    }

}
Copy
To-do List AshcoOoOdel
GNU G++17
258 ms
1.7 MB
Accepted