답안 #91055

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
91055 2018-12-26T04:47:43 Z YottaByte 은행 (IZhO14_bank) C++14
19 / 100
2 ms 608 KB
#include <stdio.h>
using namespace std;

const int N = 20 + 1;

#define ll long long
#define ok puts("OK");
int n, m, a[N], mx;
int b[N], dp[(int)1e4];

main()
{
	scanf("%d %d", &n, &m);
	for(int i = 1; i <= n; i++)
		scanf("%d", &a[i]);
	
	for(int i = 1; i <= m; i++)
		scanf("%d", &b[i]), mx += b[i];
	
	dp[0] = 1;
	for(int i = 1; i <= m; i++)
		for(int j = mx; j >= b[i]; j--)
			if(dp[j - b[i]])
				dp[j] = 1;
	
	if(dp[a[1]]) puts("YES");
	else
	puts("NO");
}

Compilation message

bank.cpp:11:6: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main()
      ^
bank.cpp: In function 'int main()':
bank.cpp:13:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d", &n, &m);
  ~~~~~^~~~~~~~~~~~~~~~~
bank.cpp:15:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &a[i]);
   ~~~~~^~~~~~~~~~~~~
bank.cpp:18:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &b[i]), mx += b[i];
   ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 500 KB Output is correct
3 Correct 2 ms 500 KB Output is correct
4 Correct 2 ms 500 KB Output is correct
5 Correct 2 ms 500 KB Output is correct
6 Correct 2 ms 508 KB Output is correct
7 Correct 2 ms 528 KB Output is correct
8 Correct 2 ms 528 KB Output is correct
9 Correct 2 ms 528 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 528 KB Output is correct
2 Correct 2 ms 528 KB Output is correct
3 Correct 2 ms 528 KB Output is correct
4 Incorrect 2 ms 528 KB Output isn't correct
5 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 528 KB Output is correct
2 Correct 2 ms 528 KB Output is correct
3 Correct 2 ms 608 KB Output is correct
4 Correct 2 ms 608 KB Output is correct
5 Incorrect 2 ms 608 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 500 KB Output is correct
3 Correct 2 ms 500 KB Output is correct
4 Correct 2 ms 500 KB Output is correct
5 Correct 2 ms 500 KB Output is correct
6 Correct 2 ms 508 KB Output is correct
7 Correct 2 ms 528 KB Output is correct
8 Correct 2 ms 528 KB Output is correct
9 Correct 2 ms 528 KB Output is correct
10 Correct 2 ms 528 KB Output is correct
11 Correct 2 ms 528 KB Output is correct
12 Correct 2 ms 528 KB Output is correct
13 Incorrect 2 ms 528 KB Output isn't correct
14 Halted 0 ms 0 KB -