# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
25549 | 2017-06-23T04:17:26 Z | 김현수(#1073) | 스트랩 (JOI14_straps) | C++11 | 16 ms | 33456 KB |
#include<bits/stdc++.h> using namespace std; typedef long long ll; const ll inf = 1e18; ll n, a[2005], b[2005], dt[2005][2005]; int main() { scanf("%lld",&n); for(ll i=1;i<=n;i++) { scanf("%lld%lld",&a[i],&b[i]); } for(ll i=0;i<=n;i++) { for(ll j=0;j<=n;j++) dt[i][j] = -inf; } dt[0][1] = 0; for(ll i=1;i<=n;i++) { for(ll j=0;j<=n;j++) { dt[i][j] = max(dt[i][j], dt[i-1][j]); if(j + a[i] - 1 >= 0) { ll X = min(n, j+a[i]-1); dt[i][X] = max(dt[i][X], dt[i-1][j] + b[i]); } } } ll ans = 0; for(ll i=0;i<=n;i++) ans = max(ans, dt[n][i]); printf("%lld\n",ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 33456 KB | Output is correct |
2 | Incorrect | 0 ms | 33456 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 33456 KB | Output is correct |
2 | Incorrect | 0 ms | 33456 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 33456 KB | Output is correct |
2 | Correct | 0 ms | 33456 KB | Output is correct |
3 | Incorrect | 0 ms | 33456 KB | Output isn't correct |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 16 ms | 33456 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |