#include <bits/stdc++.h>
using namespace std;
map<long long, int> p;
int main()
{
#ifdef ONLINE_JUDGE
#else
freopen("in.txt", "r", stdin);
#endif
int N;
scanf("%d", &N);
int i;
int max = 0;
long long s, tmp;
for(i = 0; i < 2*N; i++){
scanf("%lld", &s);
if(!p.count(s)){
p[s] = 0;
}
p[s]++;
if(p[s] > max){
max = p[s];
}
}
map<long long, int>:: iterator t;
long long num;
int cnt = 0;
for(t = p.begin(); t != p.end(); t++){
if(t->second == max){
cnt++;
if(cnt == 1){
num = t->first;
}
}
}
printf("%lld %d", num, max);
if(cnt > 1){
printf(" %d", cnt);
}
return 0;
}
PTA 7-14 電話聊天狂人 (25 分)
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.