Submission #862483

#TimeUsernameProblemLanguageResultExecution timeMemory
862483maks007Olympiads (BOI19_olympiads)C++14
0 / 100
2059 ms348 KiB
#include "bits/stdc++.h" using namespace std; signed main () { int n, m, k; cin >> n >> m >> k; vector <vector <int>> a(n, vector <int> (m)); vector <int> v, pos(m,0); function <void(int,int)> f=[&](int last, int cnt) { if(cnt == k) { v.push_back(accumulate(pos.begin(), pos.end(), 0)); return; } vector <int> prev=pos; for(int i = last; i < n; i ++) { for(int j = 0; j < m; j ++) { pos[j] = max(pos[j], a[i][j]); } f(i+1, cnt + 1); pos = prev; } }; for(int i = 0; i < n; i ++) { for(int j = 0; j < m; j ++) { cin >> a[i][j]; } } f(0, 0); sort(v.rbegin(), v.rend()); // for(auto i : v) cout << i << " "; cout << v[k-1]; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...