답안 #1087344

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1087344 2024-09-12T14:00:10 Z vjudge1 Izbori (COCI17_izbori) C++17
40 / 80
1 ms 604 KB
#include <bits/stdc++.h>
using namespace std;
#define int long long



signed main() {
    int n, m, k;
    cin >> n >> m >> k;
    int a[n][m];
    for(int i = 0;i < n; i++){
        for(int j = 0;j < m ;j++){
            cin >> a[i][j];
        }
    }
    int cnt[16] = {};
    pair<int, int>mx = {-1, -1};
    for(int i = 0;i < n; i++){
        cnt[a[i][0]]++;
        mx = max(mx, make_pair(cnt[a[i][0]], a[i][0]));
    }
    cout << mx.second << endl;
    int poi[n] = {}, ans = 0;
    while(true){
        for(int i = 0;i < 16; i++)cnt[i] = 0;
        mx = {-1, -1};
        for(int i = 0;i < n; i++){
        cnt[a[i][poi[i]]]++;
        mx = max(mx, make_pair(cnt[a[i][poi[i]]], a[i][poi[i]]));
        }

        if(mx.second == k)break;
        for(int i = 0;i < n; i++){
            if(poi[i]<m and mx.second==a[i][poi[i]]  )poi[i]++;
        }
        
        ans++;
        
    }
  cout << ans << endl;
    
    
    }
# 결과 실행 시간 메모리 Grader output
1 Partially correct 0 ms 344 KB Partially correct
2 Partially correct 1 ms 348 KB Partially correct
3 Partially correct 0 ms 348 KB Partially correct
4 Partially correct 1 ms 348 KB Partially correct
5 Partially correct 0 ms 348 KB Partially correct
6 Incorrect 1 ms 348 KB Output isn't correct
7 Partially correct 0 ms 440 KB Partially correct
8 Partially correct 0 ms 348 KB Partially correct
9 Partially correct 0 ms 348 KB Partially correct
10 Partially correct 1 ms 348 KB Partially correct
11 Correct 1 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
13 Partially correct 0 ms 348 KB Partially correct
14 Partially correct 0 ms 348 KB Partially correct
15 Partially correct 0 ms 348 KB Partially correct
16 Partially correct 1 ms 348 KB Partially correct
17 Partially correct 0 ms 348 KB Partially correct
18 Incorrect 1 ms 348 KB Output isn't correct
19 Partially correct 0 ms 604 KB Partially correct
20 Partially correct 1 ms 348 KB Partially correct