Submission #493577

#TimeUsernameProblemLanguageResultExecution timeMemory
493577reniSchools (IZhO13_school)C++14
15 / 100
2097 ms27148 KiB
#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)

school.cpp: In function 'int main()':
school.cpp:19:15: warning: unused variable 'br' [-Wunused-variable]
   19 |     long long br=0,m,s,i,j;
      |               ^~
school.cpp:19:26: warning: unused variable 'j' [-Wunused-variable]
   19 |     long long br=0,m,s,i,j;
      |                          ^
#Verdict Execution timeMemoryGrader output
Fetching results...