# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
217131 | 2020-03-29T05:54:59 Z | juggernaut | 코알라 (JOI13_koala) | C++14 | 865 ms | 4756 KB |
//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[100005],j,cnt; pair<ll,ll>p[100005]; 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]=dp[j]-a*((p[i].fr-p[1].fr+d-1)/d)+p[i].sc; cnt=1000; for(j=i-1;j>0&&cnt--;j--,cnt)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
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 10 ms | 384 KB | Output is correct |
2 | Correct | 9 ms | 384 KB | Output is correct |
3 | Correct | 7 ms | 384 KB | Output is correct |
4 | Correct | 6 ms | 384 KB | Output is correct |
5 | Correct | 8 ms | 384 KB | Output is correct |
6 | Correct | 8 ms | 384 KB | Output is correct |
7 | Correct | 4 ms | 384 KB | Output is correct |
8 | Correct | 10 ms | 384 KB | Output is correct |
9 | Correct | 8 ms | 384 KB | Output is correct |
10 | Correct | 8 ms | 384 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 856 ms | 4472 KB | Output is correct |
2 | Correct | 666 ms | 4460 KB | Output is correct |
3 | Correct | 639 ms | 3320 KB | Output is correct |
4 | Correct | 865 ms | 4728 KB | Output is correct |
5 | Correct | 531 ms | 2936 KB | Output is correct |
6 | Correct | 327 ms | 1912 KB | Output is correct |
7 | Incorrect | 717 ms | 3576 KB | Output isn't correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 669 ms | 4472 KB | Output is correct |
2 | Correct | 619 ms | 4660 KB | Output is correct |
3 | Incorrect | 583 ms | 4756 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |