#include <bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define speed cin.tie (0) -> sync_with_stdio (0);ios_base::sync_with_stdio(false);cin.tie(0);
void solve()
{
int n, m, k;
cin>>n>>m>>k;
int a[n + 5][m + 5];
for(int i=0; i<n; i++)
{
for(int j=0; j<m; j++)
{
cin>>a[i][j];
}
}
int l[n + 5] = {};
map<int, int> f;
for(int j=0; j<m; j++)
{
pair<int, int> mx = {0, 0};
for(int i=0; i<n; i++)
{
if (l[i] == i) f[a[i][j]]++;
if (f[a[i][j]] == mx.first && a[i][j] < mx.second) mx = {f[a[i][j]], a[i][j]};
if (f[a[i][j]] > mx.first) mx = {f[a[i][j]], a[i][j]};
}
if (j == 0) cout<<mx.second<<endl;
if (mx.second == k)
{
cout<<j<<endl;
break;
}
for(int i=0; i<n; i++)
{
if (a[i][j] == mx.second) l[i]++;
}
}
}
signed main ()
{
speed
// freopen("feast.in", "r", stdin);
// freopen("feast.out", "w", stdout);
int _ = 1;
// cin>>_;
while(_--) solve();
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
2 |
Partially correct |
0 ms |
344 KB |
Partially correct |
3 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
4 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
5 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
6 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
7 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
8 |
Partially correct |
0 ms |
348 KB |
Partially correct |
9 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
10 |
Incorrect |
0 ms |
344 KB |
Output isn't correct |
11 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
12 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
13 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
14 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
15 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
16 |
Partially correct |
0 ms |
348 KB |
Partially correct |
17 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
18 |
Incorrect |
0 ms |
348 KB |
Output isn't correct |
19 |
Partially correct |
0 ms |
344 KB |
Partially correct |
20 |
Partially correct |
1 ms |
348 KB |
Partially correct |