| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 176063 | bkosmacin | Izbori (COCI17_izbori) | C++14 | 42 ms | 396 KiB | 
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int maxn = 110;
int n, m, k;
vector<int> prio[maxn];
int cnt[maxn];
int sol1() {
    int mx=0,sol=1;
    for(int i=1;i<=m;i++){
        if(cnt[i]>mx){
            mx=cnt[i];
            sol=i;
        }
    }
    return sol;
}
int main() {
    cin >>n>>m>>k;
    for(int i=1;i<=n;i++){
        for(int j=0;j<m;j++) {
            int x;
            cin >> x;
            prio[i].push_back(x);
        }
        cnt[prio[i][0]]++;
    }
    cout << sol1() << endl;
    int mn=m,off_cnt;
    for(int mask = 0; mask < (1 << m); mask++) {
        off_cnt = 0;
        for(int i = 0; i < m; i++) {
            cnt[i + 1] = 0;
            if(mask & (1 << i)) {
                off_cnt++;
            }
        }
        off_cnt = m - off_cnt;
        for(int i = 1; i <= n; i++) {
            for(int j = 0; j < m; j++) {
                if(mask & (1 << (prio[i][j] - 1))) {
                    cnt[prio[i][j]]++;
                    break;
                }
            }
        }
        if(sol1()==k) {
            mn = min(mn, off_cnt);
        }
    }
    cout << mn << endl;
    return 0;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
