# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1098156 | vjudge1 | Bank (IZhO14_bank) | C++17 | 3 ms | 604 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define int unsigned long
using namespace std;
signed main() {
freopen("bank.in", "r", stdin);
freopen("bank.out", "w", stdout);
int n, m;
cin >> n >> m;
bool q=false;
vector<int> a(n),ba(m);
for(int i=0;i<n;i++){
cin >> a[i];
}
for(int i=0;i<m;i++){
cin >> ba[i];
}
vector<bool> dp(5000,false);
dp[0]=true;
for(int b : ba){
for(int j=5000;j>=b;j--){
if (dp[j-b]) {
dp[j]=true;
}
}
}
for(int s : a){
if(!dp[s]){
cout << "NO";
return 0;
}
}
cout << "YES";
}
Compilation message (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... |