제출 #236722

#제출 시각아이디문제언어결과실행 시간메모리
236722VEGAnnIzbori (COCI17_izbori)C++14
44 / 80
19 ms768 KiB
#include <bits/stdc++.h> using namespace std; const int N = 1010; const int oo = int(2e9); bool mrk[N]; int n, m, k, ans = oo, kol[N], per[N][N]; int who(int mask){ fill(kol, kol + m, 0); for (int i = 0; i < n; i++){ for (int j = 0; j < m; j++) if (!(mask & (1 << j))) { kol[per[i][j]]++; break; } } int mx = -1; for (int i = 0; i < m; i++) mx = max(mx, kol[i]); for (int i = 0; i < m; i++) if (mx == kol[i]) return i; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cin >> n >> m >> k; k--; for (int i = 0; i < n; i++) for (int j = 0; j < m; j++) { cin >> per[i][j]; per[i][j]--; } cout << who(0) + 1 << '\n'; for (int mask = 0; mask < (1 << m) - 1; mask++) if (who(mask) == k) ans = min(ans, __builtin_popcount(mask)); cout << ans; return 0; }

컴파일 시 표준 에러 (stderr) 메시지

izbori.cpp: In function 'int who(int)':
izbori.cpp:27:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
#Verdict Execution timeMemoryGrader output
Fetching results...