# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
217129 | juggernaut | 코알라 (JOI13_koala) | C++14 | 10 ms | 512 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.
//Just try and the idea will come
#include<bits/stdc++.h>
#define fr first
#define sc second
using namespace std;
typedef long long int ll;
ll k,m,d,a,n,i,dp[1005],j;
pair<ll,ll>p[1005];
int main(){
scanf("%lld%lld%lld%lld%lld",&k,&m,&d,&a,&n);
for(i=2;i<n+2;i++)scanf("%lld%lld",&p[i].fr,&p[i].sc);
p[1]={k,0};
n+=2;
p[n]={m,0};
for(i=2;i<=n;i++){
dp[i]=-1e18;
for(j=1;j<i;j++)dp[i]=max(dp[i],dp[j]-a*((p[i].fr-p[j].fr+d-1)/d)+p[i].sc);
}
printf("%lld",dp[n]);
}
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... |