| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 176144 | notwhatyouneedtoknow | Izbori (COCI17_izbori) | C++14 | 16 ms | 504 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;
int n, m, k, x, rj=20;
int polje [110][17];
int brojac [15];
int main ( ){
    ios::sync_with_stdio(false);
    cin.tie(NULL);
    cin >> n >> m >> k;
    k--;
    for (int i=0; i<n; i++){
        for (int j=0; j<m; j++){
            cin >> polje [i][j];
            polje[i][j]--;
        }
    }
    for (int mask=0; mask<(1<<m); mask++){
        if (mask & (1<<k)) continue;
        for (int i=0; i<m; i++) brojac[i]=0;
        for (int i=0; i<n; i++){
            int j=0;
            while (mask & (1<<polje[i][j])) j++;
            brojac [polje[i][j]]++;
        }
        x=0;
        for (int i=1; i<m; i++){
            if (brojac[i]>brojac[x]) x=i;
        }
        if (mask==0) cout << x+1 << endl;
        if (x==k){
            x=0;
            for (int i=0; i<m; i++){
                if (mask & (1<<i)){
                    x++;
                }
            }
            rj = min(rj, x);
        }
    }
    cout << rj;
    return 0;
}
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
