本来想创个大数组的,一狠心创了个int color[(int)1e9],结果根本不能创这么多(笑,后来就改成了map
#include<iostream>
#include<map>
using namespace std;
map<int, int>color;
int main() {
int M, N; cin >> M >> N;
int max_num = 0; int max_color = -1;
for (int i = 1; i <= N; i++) {
for (int j = 1; j <= M; j++) {
int temp; cin >> temp;
color[temp]++;
if (color[temp] > max_num) {
max_num = color[temp];
max_color = temp;
}
}
}
cout << max_color;
return 0;
}