# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1089024 |
2024-09-15T18:59:07 Z |
vjudge1 |
Izbori (COCI17_izbori) |
C++17 |
|
116 ms |
65536 KB |
#include "bits/stdc++.h"
const signed MOD = 1e9 + 7;
const signed mod = 998244353;
using namespace std;
#define all(x) x.begin(), x.end()
#define ld long double
#define ll long long
#define pb push_back
#define mp make_pair
#define co cout <<
#define S second
#define F first
int n, m, k, ans, a[105][20];
void sol(vector<bool> v, int cn) {
if (cn == m) return;
int f[20] = {};
for (int i = 0; i < n; i++) {
int j = 0;
while (j < m && v[a[i][j]]) j++;
if (j < m) f[a[i][j]]++;
}
int mx = 0, num;
for (int i = 1; i <= m; i++) {
if (f[i] > mx) {
mx = f[i];
num = i;
}
}
if (num == k) ans = min(ans, cn);
if (cn == 0) co num << '\n';
sol(v, cn + 1);
v[cn + 1] = 1;
sol(v, cn);
}
void solve() {
cin >> n >> m >> k;
for (int i = 0; i < n; i++) {
for (int j = 0; j < m; j++) {
cin >> a[i][j];
}
}
vector<bool> v(20, 0);
ans = m - 1;
sol(v, 0);
co ans;
}
signed main() {
cin.tie(0)->sync_with_stdio(0);
signed t = 1;
// cin >> t;
while (t--) solve();
}
Compilation message
izbori.cpp: In function 'void sol(std::vector<bool>, int)':
izbori.cpp:32:28: warning: 'num' may be used uninitialized in this function [-Wmaybe-uninitialized]
32 | if (cn == 0) co num << '\n';
| ^~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
104 ms |
65536 KB |
Execution killed with signal 9 |
2 |
Runtime error |
73 ms |
65536 KB |
Execution killed with signal 9 |
3 |
Runtime error |
98 ms |
65536 KB |
Execution killed with signal 9 |
4 |
Runtime error |
113 ms |
65536 KB |
Execution killed with signal 9 |
5 |
Runtime error |
98 ms |
65536 KB |
Execution killed with signal 9 |
6 |
Runtime error |
91 ms |
65536 KB |
Execution killed with signal 9 |
7 |
Runtime error |
94 ms |
65536 KB |
Execution killed with signal 9 |
8 |
Runtime error |
84 ms |
65536 KB |
Execution killed with signal 9 |
9 |
Runtime error |
113 ms |
65536 KB |
Execution killed with signal 9 |
10 |
Runtime error |
81 ms |
65536 KB |
Execution killed with signal 9 |
11 |
Runtime error |
103 ms |
65536 KB |
Execution killed with signal 9 |
12 |
Runtime error |
114 ms |
65536 KB |
Execution killed with signal 9 |
13 |
Runtime error |
104 ms |
65536 KB |
Execution killed with signal 9 |
14 |
Runtime error |
101 ms |
65536 KB |
Execution killed with signal 9 |
15 |
Runtime error |
103 ms |
65536 KB |
Execution killed with signal 9 |
16 |
Runtime error |
116 ms |
65536 KB |
Execution killed with signal 9 |
17 |
Runtime error |
108 ms |
65536 KB |
Execution killed with signal 9 |
18 |
Runtime error |
104 ms |
65536 KB |
Execution killed with signal 9 |
19 |
Runtime error |
104 ms |
65536 KB |
Execution killed with signal 9 |
20 |
Runtime error |
108 ms |
65536 KB |
Execution killed with signal 9 |