제출 #528755

#제출 시각아이디문제언어결과실행 시간메모리
528755Halym2007Bank (IZhO14_bank)C++17
19 / 100
1 ms332 KiB
#include <bits/stdc++.h>
#define ff first
#define ss second
#define cont continue;
#define sz size()
#define pb push_back
using namespace std;
typedef long long ll;
const int N = 100005;

void solve();
ll n, m, b[N], jp, c, dp[N];
int main() {
	// ios::sync_with_stdio(false);
 	// cin.tie(0);
	// freopen("bank.in", "r", stdin);
	// freopen("bank.out", "w", stdout);
	cin >> n >> m;
	cin >> jp;
	for (int i = 1; i <= m; ++i) cin >> b[i], c += b[i];
	for (int i = 1; i <= m; ++i) {
		for (int j = c; j >= 0; --j) {
			if (dp[j] > 0 or j == 0) {
				dp[j + b[i]] = 1;
			}
		}
	}
	if (dp[jp] != 0) cout << "YES\n";
	else cout << "NO\n";
}
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...