网址: https://cspjs.online/contest/648/problem/2
题解: https://b1bznc26af6.feishu.cn/file/GPkxb1gqwowN1Gxc9E5c0bpnntb?from=from_copylink
#include <bits/stdc++.h>
using namespace std;
int a[200010];
int c[200010];
signed main() {
freopen("cute.in", "r", stdin);
freopen("cute.out", "w", stdout);
int t;
cin >> t;
while (t--) {
memset(c, 0, sizeof c);
int n;
cin >> n;
for (int i = 1; i <= n; i++) {
cin >> a[i];
c[a[i]]++;
}
long long mx = 0;
for (int i = 1; i <= n; i++) {
mx = max(mx, (long long)i * c[i]);
}
cout << mx << '\n';
}
}