-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbee1403.cpp
More file actions
43 lines (33 loc) · 737 Bytes
/
Copy pathbee1403.cpp
File metadata and controls
43 lines (33 loc) · 737 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
* Contest : Beecrowd
* Problem : 1403 - Meu Avô é Famoso
* Link : https://judge.beecrowd.com/pt/problems/view/1403
*/
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define fastio ios::sync_with_stdio(0); cin.tie(0);
int n, m;
void solve() {
vector<int> freq(10'001);
for (int i = 0; i < n; ++i) {
for (int j = 0; j < m; ++j) {
int x; cin >> x;
freq[x]++;
}
}
set<int> qtt;
for (auto &i : freq) qtt.insert(i);
auto second = qtt.rbegin();
// 2 5 10 <-
second++;
// 2 5 <- 10
for (int i = 1; i < freq.size(); ++i)
if (freq[i] == *second) cout << i << ' ';
cout << '\n';
}
int main() {
fastio
while (cin >> n >> m && n && m) solve();
return 0;
}