# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
646263 | berr | Olympiads (BOI19_olympiads) | C++17 | 282 ms | 262144 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define int long long
int32_t main()
{
ios_base::sync_with_stdio(false); cin.tie(0);
int n, k, c; cin>>n>>k>>c;
vector<vector<int>> a[k+1];
vector<vector<int>> b(n, vector<int>(k));
for(int i=0; i<n; i++)
{
for(int l=0; l<k; l++)
{
cin>>b[i][l];
}
}
for(int i=0; i<n; i++)
{
for(int l=k-1; l>=1; l--)
{
for(auto p: a[l])
{
vector<int> s=p;
for(int j=0; j<k; j++) s[j]=max(s[j], b[i][j]);
a[l+1].push_back(s);
}
}
a[1].push_back(b[i]);
}
vector<int> ans;
for(int i=0; i<a[k].size(); i++)
{
int s=0;
for(auto l: a[k][i])
{
s+=l;
}
ans.push_back(s);
}
sort(ans.begin(), ans.end(), greater<int>());
cout<<ans[c-1];
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |