# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
14697 |
2015-06-10T06:56:00 Z |
ansol4328 |
앱 (KOI13_app) |
C++ |
|
4 ms |
5068 KB |
#include<stdio.h>
#include<stdlib.h>
int dp[102][10002];
int main()
{
int i, j, n, need, m[102][4];
scanf("%d %d",&n,&need);
for(i=1 ; i<=n ; i++) scanf("%d",&m[i][1]);
for(i=1 ; i<=n ; i++) scanf("%d",&m[i][2]);
for(i=1 ; i<=n ; i++)
{
for(j=1 ; j<=10000 ; j++) dp[i][j]=dp[i-1][j];
for(j=1 ; j<=10000 ; j++)
{
if(j-m[i][2]>=0)
{
if(dp[i][j]<dp[i-1][j-m[i][2]]+m[i][1]) dp[i][j]=dp[i-1][j-m[i][2]]+m[i][1];
}
}
}
for(j=1 ; j<=10000 ; j++)
{
for(i=1 ; i<=n ; i++)
{
if(dp[i][j]>=need)
{
printf("%d",j);
exit(1);
}
}
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
5068 KB |
Output is correct |
2 |
Correct |
0 ms |
5068 KB |
Output is correct |
3 |
Correct |
0 ms |
5068 KB |
Output is correct |
4 |
Correct |
0 ms |
5068 KB |
Output is correct |
5 |
Correct |
0 ms |
5068 KB |
Output is correct |
6 |
Correct |
0 ms |
5068 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
5068 KB |
Output is correct |
2 |
Correct |
0 ms |
5068 KB |
Output is correct |
3 |
Correct |
0 ms |
5068 KB |
Output is correct |
4 |
Correct |
0 ms |
5068 KB |
Output is correct |
5 |
Correct |
0 ms |
5068 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
5068 KB |
Output is correct |
2 |
Correct |
0 ms |
5068 KB |
Output is correct |
3 |
Correct |
2 ms |
5068 KB |
Output is correct |
4 |
Correct |
2 ms |
5068 KB |
Output is correct |
5 |
Correct |
2 ms |
5068 KB |
Output is correct |
6 |
Correct |
2 ms |
5068 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
5068 KB |
Output is correct |
2 |
Correct |
0 ms |
5068 KB |
Output is correct |
3 |
Correct |
0 ms |
5068 KB |
Output is correct |
4 |
Correct |
0 ms |
5068 KB |
Output is correct |
5 |
Correct |
0 ms |
5068 KB |
Output is correct |
6 |
Correct |
0 ms |
5068 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
5068 KB |
Output is correct |
2 |
Correct |
4 ms |
5068 KB |
Output is correct |
3 |
Correct |
0 ms |
5068 KB |
Output is correct |
4 |
Correct |
0 ms |
5068 KB |
Output is correct |
5 |
Correct |
0 ms |
5068 KB |
Output is correct |
6 |
Correct |
0 ms |
5068 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
4 ms |
5068 KB |
Output is correct |
2 |
Correct |
3 ms |
5068 KB |
Output is correct |
3 |
Correct |
0 ms |
5068 KB |
Output is correct |
4 |
Correct |
0 ms |
5068 KB |
Output is correct |
5 |
Correct |
0 ms |
5068 KB |
Output is correct |
6 |
Correct |
0 ms |
5068 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
5068 KB |
Output is correct |
2 |
Correct |
4 ms |
5068 KB |
Output is correct |
3 |
Correct |
0 ms |
5068 KB |
Output is correct |
4 |
Correct |
4 ms |
5068 KB |
Output is correct |