Source Code
#include<iostream>
#include<math.h>
using namespace std;


//int size = 100001;

int main (){


  int Test;
  cin>>Test;

  while(Test>0){
    int n;
    int max =-1;
    cin>>n;
    int loki[100001];
    for (int i=0;i<n;i++){
      cin>>loki[i];
      if(loki[i]>max){
        max=loki[i];
      }

    }
    for(int i=0;i<n;i++){
      if(loki[i]==max){
        cout<<loki[i]<<" ";
      }
    }
    cout<<endl;

    Test--;
  }

  }
Copy
To-do List King_Of_Asgard
GNU G++17
254 ms
1.2 MB
Accepted