Submission #700745

#TimeUsernameProblemLanguageResultExecution timeMemory
700745Jarif_RahmanOlympiads (BOI19_olympiads)C++17
44 / 100
2071 ms187724 KiB
#include <bits/stdc++.h> #define pb push_back #define f first #define sc second using namespace std; typedef long long int ll; typedef string str; int n, k, c; //multiset<ll, greater<ll>> ss; vector<ll> sth; vector<vector<ll>> v; void bf(int cnt, int c, vector<ll> cur){ if(cnt == k){ ll s = 0; for(ll x: cur) s+=x; //ss.insert(s); //if(ss.size() > c+5) ss.erase(prev(ss.end())); sth.pb(s); return; } if(c == n) return; bf(cnt, c+1, cur); for(int i = 0; i < k; i++) cur[i] = max(cur[i], v[c][i]); bf(cnt+1, c+1, cur); if(c == n) return; } int main(){ ios_base::sync_with_stdio(0); cin.tie(0); cin >> n >> k >> c; for(int i = 0; i < n; i++){ vector<ll> sth(k); for(ll &x: sth) cin >> x; v.pb(sth); } bf(0, 0, vector<ll>(k, 0)); c--; //cout << *next(ss.begin(), c) << "\n"; sort(sth.rbegin(), sth.rend()); cout << sth[c] << "\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...