Submission #602625

#TimeUsernameProblemLanguageResultExecution timeMemory
602625WongChun1234Olympiads (BOI19_olympiads)C++14
0 / 100
1 ms440 KiB
#include<bits/stdc++.h> using namespace std; int n,m,k,a[7][550]; vector<int> srt; 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>>m>>k; for (int i=1;i<=n;i++) for (int j=1;j<=k;j++) cin>>a[j][i]; vector<int> tmp={}; 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...