제출 #337284

#제출 시각아이디문제언어결과실행 시간메모리
337284kutbilim_one은행 (IZhO14_bank)C++14
19 / 100
1 ms364 KiB
/** kutbilim.one **/ #include <bits/stdc++.h> using namespace std; #define all(x) x.begin(),x.end() #define int long long #define endl '\n' signed main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); //ifstream cin("test.txt"); int n, m; cin >> n >> m; vector<int> a(n), b(m); for(int i = 0; i < n; i++) cin >> a[i]; for(int i = 0; i < m; i++) cin >> b[i]; int result_out = 0; if(n == 1){ vector<int> dp(a[0]+1); dp[0] = 1; sort(all(b)); for(int i = m; i >= 0; i--){ for(int j = a[0]-b[i]; j >= 0; j--){ dp[j+b[i]] = dp[j+b[i]] || dp[j]; } } result_out = dp[a[0]]; } cout << (result_out ? "YES" : "NO"); //return main(); 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...