# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
32115 |
2017-09-26T08:23:39 Z |
dongwon0427 |
스트랩 (JOI14_straps) |
C++ |
|
23 ms |
17892 KB |
#include <bits/stdc++.h>
using namespace std;
#define INF 2000000001
int n;
int dp[2005][2005];
struct _tuple {
int dan,val;
};
_tuple A[2005];
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
cin>>n;
for(int i=1;i<=n;i++) cin>>A[i].dan>>A[i].val;
for(int i=0;i<=n;i++) {
for(int j=0;j<=2000;j++) {
dp[i][j]=-INF;
}
}
dp[0][1]=0;
for(int i=1;i<=n;i++) {
for(int j=0;j<=2000;j++) {
dp[i][j]=dp[i-1][j];
}
for(int j=1;j<=2000;j++) {
dp[i][min(j-1+A[i].dan,2000)] = max(dp[i][min(j-1+A[i].dan,2000)] , dp[i-1][j] + A[i].val);
}
}
int ans=0;
for(int i=0;i<=2000;i++) {
ans=max(ans,dp[n][i]);
}
cout<<ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
17892 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
0 ms |
17892 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
17892 KB |
Output is correct |
2 |
Incorrect |
0 ms |
17892 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
23 ms |
17892 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |