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


int size = 1000001;

int main (){


  int Test;
  cin>>Test;

  while(Test>0){
    int n;
    int max =-1;
    cin>>n;
    int loki[size];
    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
0 ms
0 KB
Compilation Error