| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 176144 | notwhatyouneedtoknow | Izbori (COCI17_izbori) | C++14 | 16 ms | 504 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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... | ||||
