| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1329808 | riafhasan2010 | 은행 (IZhO14_bank) | C++17 | 4 ms | 344 KiB |
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const ll inf = 1e17;
int a[23], b[23];
bool sum[1001];
void rec(int n, int cur) {
if (n < 0) return;
sum[cur] = true;
rec(n - 1, cur);
if (cur + b[n] <= a[0]) rec(n - 1, cur + b[n]);
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int n, m; cin >> n >> m;
for (int i = 0; i < n; i++) cin >> a[i];
for (int i = 0; i < m; i++) cin >> b[i];
rec(m, 0);
cout << (sum[a[0]] ? "YES" : "NO") << '\n';
}
| # | 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... | ||||
