L1-034 点赞 分数 20

// 6'22"
#include <bits/stdc++.h>
using namespace std;
int main()
{
    int n;
    cin >> n;
    map<int,int> hash;
    for(int i = 1; i <= n; ++ i)
    {
        int k;
        cin >> k;
        for(int j = 1; j <= k; ++ j)
        {
            int tmp;
            cin >> tmp;
            hash[tmp] ++;
        }
    }
    int max = -114514;
    int num = -114514;
    for(auto h : hash)
    {
        if(h.second > max || (h.second == max && h.first > num))
        {
            max = h.second;
            num = h.first;
        }
    }
    cout << num << " " << max;
    return 0;
}
posted @ 2024-08-02 23:53  Frodnx  阅读(19)  评论(0)    收藏  举报