Submission #602628

#TimeUsernameProblemLanguageResultExecution timeMemory
602628WongChun1234Olympiads (BOI19_olympiads)C++14
44 / 100
1907 ms262144 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...