#include<vector>
#include<iostream>
#include<algorithm>
#include<unordered_map>
#include<set>
#include<map>
#include<cstring>
#include<string>
using namespace std;
int main()
{
int n, m, col;
scanf("%d%d",&n,&m);
map<int, int>count;
for (int i = 0; i < n; i++)
{
for (int j = 0; j < m; j++)
{
scanf("%d",&col);
if (count.find(col) != count.end())
count[col]++;
else
count[col] = 1;
}
}
int k = 0, max = 0;
for (map<int,int>::iterator it=count.begin();it!=count.end();it++)
{
if (it->second > max)
{
k = it->first;
max = it->second;
}
}
cout << k << endl;
}
A1054 The Dominant Color [map]
最新推荐文章于 2023-07-28 00:26:44 发布