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

using namespace std;

int main() {
    ios_base::sync_with_stdio(0);
    cin.tie(NULL);
    cout.tie(NULL);
   
    int tt;
    cin>>tt;
    while(tt--){
       int siz;
       cin>>siz;
       long long arr[siz];
       for (int i=0;i<siz;i++){
           cin>>arr[i];
       }
       int max=0;
       int i;
       for (i=0;i<siz;i++){

           if (max<arr[i])
                max=arr[i];
       }
           for(int i = 0 ; i < siz ; i++)
               if (arr[i] == max){
               		cout<<max<<" ";
			   }
			   cout<<endl;
           }
return 0;
}
Copy
To-do List Mohamedmaher
GNU G++17
50 ms
2.2 MB
Accepted