fork download
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. const int N=1e6+4;
  4. long long a[N],n;
  5. map<long long ,long long>mp;
  6. int main()
  7. {
  8. cin>>n;
  9. for(int i=1;i<=n;i++)
  10. {
  11. cin>>a[i];
  12. mp[a[i]]++;
  13. }
  14. long long kq=LLONG_MIN,s=0;
  15. for(auto x : mp)
  16. {
  17. if(x.second>kq)
  18. {
  19. kq=x.second;
  20. s=x.first;
  21. }
  22. }
  23. cout<<s<<" "<<kq;
  24. }
  25.  
Success #stdin #stdout 0.01s 5504KB
stdin
Standard input is empty
stdout
0 -9223372036854775808