Submission #37606

# Submission time Handle Problem Language Result Execution time Memory
37606 2017-12-26T10:49:08 Z 14kg 앱 (KOI13_app) C++11
21 / 21
723 ms 40176 KB
#include <stdio.h>
#include <algorithm>
#define INF 999999999
#define min2(x,y) (x<y?x:y)

using namespace std;
int n, m, d[10000001];
pair<int, int> in[101];

int main() {
	scanf("%d %d", &n, &m);
	for (int i = 1; i <= n; i++) {
		scanf("%d", &in[i].first);
		in[i].first = min2(in[i].first, m);
	}
	for (int i = 1; i <= n; i++) scanf("%d", &in[i].second);
	for (int i = 1; i <= m; i++) d[i] = INF;

	for (int i = 1; i <= n; i++)
		for (int j = m; j >= 0; j--)
			d[min2(m,j + in[i].first)] = min2(d[min2(m,j + in[i].first)], d[j] + in[i].second);
	printf("%d", d[m]);
}

Compilation message

app.cpp: In function 'int main()':
app.cpp:11:24: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &n, &m);
                        ^
app.cpp:13:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &in[i].first);
                            ^
app.cpp:16:57: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  for (int i = 1; i <= n; i++) scanf("%d", &in[i].second);
                                                         ^
# Verdict Execution time Memory Grader output
1 Correct 0 ms 40176 KB Output is correct
2 Correct 0 ms 40176 KB Output is correct
3 Correct 0 ms 40176 KB Output is correct
4 Correct 0 ms 40176 KB Output is correct
5 Correct 0 ms 40176 KB Output is correct
6 Correct 0 ms 40176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 40176 KB Output is correct
2 Correct 0 ms 40176 KB Output is correct
3 Correct 0 ms 40176 KB Output is correct
4 Correct 0 ms 40176 KB Output is correct
5 Correct 0 ms 40176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 6 ms 40176 KB Output is correct
2 Correct 0 ms 40176 KB Output is correct
3 Correct 9 ms 40176 KB Output is correct
4 Correct 29 ms 40176 KB Output is correct
5 Correct 0 ms 40176 KB Output is correct
6 Correct 23 ms 40176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 40176 KB Output is correct
2 Correct 23 ms 40176 KB Output is correct
3 Correct 13 ms 40176 KB Output is correct
4 Correct 36 ms 40176 KB Output is correct
5 Correct 23 ms 40176 KB Output is correct
6 Correct 0 ms 40176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 376 ms 40176 KB Output is correct
2 Correct 596 ms 40176 KB Output is correct
3 Correct 723 ms 40176 KB Output is correct
4 Correct 473 ms 40176 KB Output is correct
5 Correct 93 ms 40176 KB Output is correct
6 Correct 33 ms 40176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 649 ms 40176 KB Output is correct
2 Correct 139 ms 40176 KB Output is correct
3 Correct 6 ms 40176 KB Output is correct
4 Correct 466 ms 40176 KB Output is correct
5 Correct 36 ms 40176 KB Output is correct
6 Correct 473 ms 40176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 159 ms 40176 KB Output is correct
2 Correct 329 ms 40176 KB Output is correct
3 Correct 686 ms 40176 KB Output is correct
4 Correct 489 ms 40176 KB Output is correct