#include <bits/stdc++.h>
using namespace std;
int n, m, k, a[505][10];
vector<int> b;
int qry(vector<int> val){
int x[10];
memset(x, 0, sizeof(x));
for(int xx : x) for(int j = 0; j < m; j++) x[j] = max(x[j], a[xx][j]);
int ans = 0;
for(int j = 0; j < m; j++) ans += x[j];
return ans;
}
void make(int idx, vector<int> val){
if(idx == m){
b.push_back(qry(val)); return;
}
for(int j = val.back() + 1; j < n; j++){
val.push_back(j);
make(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++) make(1, {i});
sort(b.rbegin(), b.rend());
cout << b[k - 1] << '\n';
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
344 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
348 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
2015 ms |
132296 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1 ms |
344 KB |
Execution killed with signal 11 |
2 |
Halted |
0 ms |
0 KB |
- |