제출 #12987

#제출 시각아이디문제언어결과실행 시간메모리
12987gs14004코알라 (JOI13_koala)C++98
20 / 100
2000 ms2648 KiB
#include <cstdio> #include <algorithm> using namespace std; int d,c,n; int a[100005], b[100005]; long long dp[100005]; int main(){ int s,e; scanf("%d %d %d %d %d",&s,&e,&d,&c,&n); for (int i=1; i<=n; i++) { scanf("%d %d",&a[i],&b[i]); a[i] -= s; } a[n+1] = e-s; for (int i=n; i>=0; i--) { dp[i] = -1e18; for (int j=i+1; j<=n+1; j++) { dp[i] = max(dp[i],dp[j] - 1ll * (a[j] - a[i] + d - 1) / d * c); } dp[i] += b[i]; } printf("%lld",dp[0]); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...