Submission #1294802

#TimeUsernameProblemLanguageResultExecution timeMemory
1294802LIABank (IZhO14_bank)C++17
0 / 100
1 ms836 KiB
// // Created by liasa on 25/11/2025. // #include <bits/stdc++.h> using namespace std; #define ll long long #define v vector #define lp(i, s, e) for (int i = s; i < e; ++i) int main() { ios_base::sync_with_stdio(0); cin.tie(0); int n, m; cin >> n >> m; v<int> a(n), b(m); lp(i, 0, n) cin >> a[i]; lp(i, 0, m) cin >> b[i]; ll val = a[0]; ll mx = 1001; v<int> dp(mx); dp[0] = 1; lp(i, 0, mx) { for (auto it : b) { if (i - it >= 0 && dp[i - it] == 1) dp[i] = 1; } } ll ans = dp[val]; cout << (ans ? "YES" : "NO"); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...