# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1087374 | kasdo | Izbori (COCI17_izbori) | C++17 | 1 ms | 452 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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] = {};
for(int j=0; j<m; j++)
{
pair<int, int> mx = {0, 0};
int f[m + 5] = {};
for(int i=0; i<n; i++)
{
f[a[l[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;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |