Submission #528750

#TimeUsernameProblemLanguageResultExecution timeMemory
528750Halym2007은행 (IZhO14_bank)C++17
0 / 100
2 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();
int 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";
}

Compilation message (stderr)

bank.cpp: In function 'int main()':
bank.cpp:16:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |  freopen("bank.in", "r", stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~
bank.cpp:17:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |  freopen("bank.out", "w", stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...