# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
493577 | reni | Schools (IZhO13_school) | C++14 | 2097 ms | 27148 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<iostream>
using namespace std;
long long a[10000000], b[1000003], dp[1000000][3],n;
long long rec(long long pos,long long m,long long s)
{
if(pos==n)return 0;
long long maxi=0;
if(m>0)maxi=max(maxi, rec(pos+1,m-1,s)+a[pos]);
if(s>0)maxi=max(maxi, rec(pos+1,m,s-1)+b[pos]);
maxi=max(maxi, rec(pos+1,m,s));
return maxi;
}
int main()
{
long long br=0,m,s,i,j;
cin>>n>>m>>s;
for(i=0;i<n;i++)
{
cin>>a[i]>>b[i];
}
cout<<rec(0,m,s)<<endl;
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |