# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
8240 |
2014-09-07T14:17:43 Z |
dohyun0324 |
스트랩 (JOI14_straps) |
C++ |
|
8 ms |
16884 KB |
#include<stdio.h>
#include<algorithm>
using namespace std;
int dap,n,a[2010],b[2010],d[2010][2010];
int main()
{
int i,j;
scanf("%d",&n);
for(i=1;i<=n;i++)
{
scanf("%d %d",&a[i],&b[i]);
}
for(i=0;i<=n;i++)
{
for(j=2;j<=2000;j++)
{
d[i][j]=-2147483647;
}
}
for(i=1;i<=n;i++)
{
for(j=0;j<=2000;j++)
{
if(d[i-1][j]!=-2147483647)
{
d[i][min(2000,j+a[i]-1)]=max(d[i][min(2000,j+a[i]-1)],d[i-1][j]+b[i]);
d[i][j]=max(d[i][j],d[i-1][j]);
}
}
}
for(i=0;i<=2000;i++)
{
if(dap<d[n][i]) dap=d[n][i];
}
printf("%d",dap);
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
16884 KB |
Output is correct |
2 |
Incorrect |
0 ms |
16884 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
16884 KB |
Output is correct |
2 |
Incorrect |
0 ms |
16884 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
16884 KB |
Output is correct |
2 |
Correct |
0 ms |
16884 KB |
Output is correct |
3 |
Incorrect |
0 ms |
16884 KB |
Output isn't correct |
4 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
8 ms |
16884 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |