# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
18284 |
2016-01-26T12:00:57 Z |
mindol |
앱 (KOI13_app) |
C++ |
|
2 ms |
5028 KB |
#include<cstdio>
#include<algorithm>
using namespace std;
int dt[101][10001]; // dt[i][j] : A1~Ai 까지의 앱 중에서 볼 때 비용 j를 써서 얻을 수 있는 최대 메모리
int m[101],c[101];
int main()
{
int N,M,totc=0;
scanf("%d %d",&N,&M);
for(int i=1;i<=N;i++)
scanf("%d",&m[i]);
for(int i=1;i<=N;i++)
scanf("%d",&c[i]),totc+=c[i];
for(int i=1;i<=N;i++)
for(int j=0;j<=totc;j++)
{
if(j<c[i]) dt[i][j]=dt[i-1][j];
else dt[i][j]=max(dt[i-1][j],dt[i-1][j-c[i]]+m[i]);
}
for(int i=0;i<=totc;i++)
for(int j=1;j<=N;j++)
if(dt[j][i]>=M)
{
printf("%d",i);
return 0;
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
5028 KB |
Output is correct |
2 |
Correct |
0 ms |
5028 KB |
Output is correct |
3 |
Correct |
0 ms |
5028 KB |
Output is correct |
4 |
Correct |
0 ms |
5028 KB |
Output is correct |
5 |
Correct |
0 ms |
5028 KB |
Output is correct |
6 |
Correct |
0 ms |
5028 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
5028 KB |
Output is correct |
2 |
Correct |
0 ms |
5028 KB |
Output is correct |
3 |
Correct |
0 ms |
5028 KB |
Output is correct |
4 |
Correct |
0 ms |
5028 KB |
Output is correct |
5 |
Correct |
0 ms |
5028 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
5028 KB |
Output is correct |
2 |
Correct |
0 ms |
5028 KB |
Output is correct |
3 |
Correct |
0 ms |
5028 KB |
Output is correct |
4 |
Correct |
0 ms |
5028 KB |
Output is correct |
5 |
Correct |
0 ms |
5028 KB |
Output is correct |
6 |
Correct |
0 ms |
5028 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
5028 KB |
Output is correct |
2 |
Correct |
0 ms |
5028 KB |
Output is correct |
3 |
Correct |
0 ms |
5028 KB |
Output is correct |
4 |
Correct |
0 ms |
5028 KB |
Output is correct |
5 |
Correct |
0 ms |
5028 KB |
Output is correct |
6 |
Correct |
0 ms |
5028 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
5028 KB |
Output is correct |
2 |
Correct |
0 ms |
5028 KB |
Output is correct |
3 |
Correct |
0 ms |
5028 KB |
Output is correct |
4 |
Correct |
0 ms |
5028 KB |
Output is correct |
5 |
Correct |
0 ms |
5028 KB |
Output is correct |
6 |
Correct |
0 ms |
5028 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
5028 KB |
Output is correct |
2 |
Correct |
0 ms |
5028 KB |
Output is correct |
3 |
Correct |
0 ms |
5028 KB |
Output is correct |
4 |
Correct |
0 ms |
5028 KB |
Output is correct |
5 |
Correct |
0 ms |
5028 KB |
Output is correct |
6 |
Correct |
0 ms |
5028 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
5028 KB |
Output is correct |
2 |
Correct |
0 ms |
5028 KB |
Output is correct |
3 |
Correct |
2 ms |
5028 KB |
Output is correct |
4 |
Correct |
0 ms |
5028 KB |
Output is correct |