Submission #1284335

#TimeUsernameProblemLanguageResultExecution timeMemory
1284335zxzuamBank (IZhO14_bank)C++20
19 / 100
1 ms576 KiB
#include <bits/stdc++.h> using ll = int64_t; using namespace std; constexpr int maxn = 1E5 + 1; void orz() { int N, M; cin >> N >> M; vector <int> A(N + 1), B(M + 1); for(int i = 1; i <= N; i++) { cin >> A[i]; } for(int i = 1; i <= M; i++) { cin >> B[i]; } int X = A[1]; vector <bool> dp(X + 1, 0); dp[0] = 1; for(int i = 1; i <= M; ++i) { for(int j = X; j >= B[i]; j--) { dp[j] = (dp[j] || dp[j - B[i]]); } } if(dp[X]) { cout << "YES"; } else cout << "NO"; } int32_t main() { ios_base::sync_with_stdio(false), cin.tie(nullptr); //freopen("promote.in", "r", stdin); //freopen("promote.out", "w", stdout); int T = 1; //cin >> T; while(T--) orz(); 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...