Submission #37605

# Submission time Handle Problem Language Result Execution time Memory
37605 2017-12-26T10:41:45 Z 14kg 앱 (KOI13_app) C++11
3.15 / 21
539 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 - in[i].first; j >= 0; j--)
			d[j + in[i].first] = min2(d[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 Incorrect 0 ms 40176 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 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 Incorrect 3 ms 40176 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 40176 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 283 ms 40176 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 539 ms 40176 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 116 ms 40176 KB Output isn't correct
2 Halted 0 ms 0 KB -