題目錯誤
評分結果(參考) : AC (5ms, 688KB)
#include <bits/stdc++.h>
using namespace std;
int main(){
ios::sync_with_stdio(false);
cin.tie(nullptr);
int t, temp, mx = 0;
cin >> t;
unordered_map<int, int> um;
vector<int> ans;
for(int i=0; i<t; i++){
cin >> temp;
um[temp]++;
if(um[temp] > mx){
ans.clear();
ans.push_back(temp);
mx = um[temp];
}
else if(um[temp] == mx){
ans.push_back(temp);
}
}
sort(ans.begin(), ans.end());
for(int i : ans) cout << i << " " << um[i] << "\n";
return 0;
}