#include<bits/stdc++.h>
using namespace std;
int n,m,k,a[7][550];
vector<int> srt,tmp;
void exh(int id,int curr,vector<int> &hv){
if (curr==k){
int ans=0;
for (int i=1;i<=k;i++){
int cmx=0;
for (int j:hv) cmx=max(cmx,a[i][j]);
ans+=cmx;
}
srt.push_back(ans);
return;
}
for (int i=id+1;i<=n;i++){
hv.push_back(i);
exh(i,curr+1,hv);
hv.pop_back();
}
}
int main(){
cin>>n>>k>>m;
for (int i=1;i<=n;i++) for (int j=1;j<=k;j++) cin>>a[j][i];
exh(0,0,tmp);
nth_element(srt.begin(),srt.begin()+m-1,srt.end(),greater<int>());
cout<<srt[m-1]<<"\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
848 KB |
Output is correct |
2 |
Correct |
4 ms |
848 KB |
Output is correct |
3 |
Correct |
4 ms |
940 KB |
Output is correct |
4 |
Correct |
4 ms |
976 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
202 ms |
16772 KB |
Output is correct |
2 |
Correct |
229 ms |
16800 KB |
Output is correct |
3 |
Correct |
256 ms |
16844 KB |
Output is correct |
4 |
Correct |
233 ms |
16948 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
1907 ms |
262144 KB |
Execution killed with signal 9 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
848 KB |
Output is correct |
2 |
Correct |
4 ms |
848 KB |
Output is correct |
3 |
Correct |
4 ms |
940 KB |
Output is correct |
4 |
Correct |
4 ms |
976 KB |
Output is correct |
5 |
Correct |
202 ms |
16772 KB |
Output is correct |
6 |
Correct |
229 ms |
16800 KB |
Output is correct |
7 |
Correct |
256 ms |
16844 KB |
Output is correct |
8 |
Correct |
233 ms |
16948 KB |
Output is correct |
9 |
Runtime error |
1907 ms |
262144 KB |
Execution killed with signal 9 |
10 |
Halted |
0 ms |
0 KB |
- |