Submission #100480

#TimeUsernameProblemLanguageResultExecution timeMemory
100480a1_NBank (IZhO14_bank)C++14
46 / 100
3 ms384 KiB
#include <bits/stdc++.h> using namespace std; int a[25],b[25],n,m; bool can[20200]; int main(){ cin >> n >> m; for(int i = 1; i <= n; ++i){ cin >> a[i]; } for(int i = 1; i <= m; i++){ cin >> b[i]; } can[0] = 1; for(int i = 1; i <= m; i++){ for(int j = 20000; j >= 0; j--){ if(can[j]){ can[j + b[i]] = 1; } } } for(int i = 1; i <= n; i++){ if(!can[a[i]]){ cout << "NO"; return 0; } } cout << "YES"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...