$O(nlgn)$
#include<cstdio> #include<map> using namespace std; int n, c; long long x, r; map<long long, int> mp; int main() { for (scanf("%d", &n); n--;) scanf("%lld", &x), mp[x]++; for (auto &it : mp) if (it.second > c) r = it.first, c = it.second; printf("%lld", r); return 0; }
댓글 없음 :
댓글 쓰기