#include <bits/stdc++.h>
using namespace std;
constexpr int maxn = 510, maxk = 10;
int n, m, k;
int a[510][10];
vector<int> b;
int get(vector<int> val) {
int x[10];
memset(x, 0, sizeof(x));
for(int i : x) for(int j = 0; j < m; j++) val[j] = max(val[j], a[i][j]);
int ans = 0;
for(int j = 0; j < m; j++) ans += val[j];
return ans;
}
void create(int idx, vector<int> val) {
if(idx == m) return (void)(b.push_back(get(val)));
for(int j = val.back() + 1; j < n; j++) {
val.push_back(j);
create(idx + 1, val);
val.pop_back();
}
}
int main() {
cin >> n >> m >> k;
for(int i = 0; i < n; i++) for(int j = 0; j < m; j++) cin >> a[i][j];
for(int i = 0; i < n; i++) create(1, {i});
sort(b.rbegin(), b.rend());
cout << b[k - 1] << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
984 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
422 ms |
17040 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2045 ms |
133440 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
9 ms |
984 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |