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

using namespace std;

const int N=2e5+5;

int n;
int arr[N];

int main()
{
	int t;
	scanf("%d",&t);
	while(t--)
	{
		scanf("%d",&n);
		for(int i=0;i<n;i++) scanf("%d",&arr[i]);
		sort(arr,arr+n);
		for(int i=0;i<n;i++)
		{
			if(arr[i]==arr[n-1])
				printf("%d ",arr[i]);
		}
		puts("");
	}
}
Copy
To-do List mahmoudbadawy
GNU G++17
124 ms
1.2 MB
Accepted