제출 #1305840

#제출 시각아이디문제언어결과실행 시간메모리
1305840DanielPr8Olympiads (BOI19_olympiads)C++20
44 / 100
2095 ms668 KiB
#include <bits/stdc++.h> using namespace std; using ll = int; using vll = vector<ll>; using vvl = vector<vll>; using pll = pair<ll,ll>; using vpl = vector<pll>; using vvp = vector<vpl>; #define f first #define s second #define pb push_back #define all(v) v.begin(), v.end() vvl pr; ll C, n, k, kw; vll merge(vll a, vll b){ vll ans; for(ll i=0, j=0;ans.size()<C && (i<a.size() || j<b.size());){ ll o=0; if(i==a.size())o=1; else if(j<b.size() && b[j]>a[i])o=1; if(!o){ ans.pb(a[i]); i++; } else{ ans.pb(b[j]); j++; } } return ans; } vll solve(ll i, ll le, vll mx){ if(le==0)return {accumulate(all(mx),0)}; if(i+le>n)return {}; vll ans = solve(i+1, le, mx); for(ll j = 0; j < k; ++j)mx[j]=max(mx[j],pr[i][j]); vll tr = solve(i+1, le-1, mx); if(i==2 && le==2){ cout <<""; } return merge(ans,tr); } int main(){ ios_base::sync_with_stdio(0);cin.tie(NULL); cin >> n >> k >> C; kw=(1<<k); pr = vvl(n, vll(k)); for(auto& i:pr){ for(auto& j:i){ cin >> j; } } vll mx(k); vll ord = solve(0,k,mx); cout << ord.back(); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...