Submission #1088481

#TimeUsernameProblemLanguageResultExecution timeMemory
1088481vjudge1Bank (IZhO14_bank)C++17
19 / 100
1 ms604 KiB
#include <bits/stdc++.h> using namespace std; int n,m; int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); cin >> n >> m; assert(n == 1); vector<int> s(n),c(m); for(int &i : s) cin >> i; for(int &i : c) cin >> i; int maior = *max_element(s.begin(),s.end()); vector<int> dp(maior + 1,0); dp[0] = 1; for(int i : c) for(int j = maior - i;j >= 0;j--) dp[j + i] |= dp[j]; cout << (dp[s[0]] ? "YES" : "NO"); 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...