# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1277950 | bnijaamaa | Bank (IZhO14_bank) | C++20 | 56 ms | 40848 KiB |
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define all(x)(x).begin(), (x).end()
#define F first
#define S second
#define nn '\n'
#define pb push_back
signed main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
freopen("bank.in", "r", stdin);
freopen("bank.out", "w", stdout);
int n, m;
cin >> n >> m;
vector < int > a(n + 1),b(m + 1);
for (int i = 0; i < n; ++i) cin >> a[i];
for (int i = 0; i < m; ++i) cin >> b[i];
int cnt = a[0];
vector < bool > dp(cnt + 1, false);
dp[0] = true;
for (int i = 1; i <= m; ++i) {
for (int j = cnt; j >= b[i]; --j) {
if (dp[j - b[i]]) dp[j] = true;
}
}
if (dp[cnt]) cout << "YES";
else cout << "NO";
}
컴파일 시 표준 에러 (stderr) 메시지
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |