제출 #880975

#제출 시각아이디문제언어결과실행 시간메모리
880975_KuroNeko_은행 (IZhO14_bank)C++17
0 / 100
1 ms348 KiB
#include<bits/stdc++.h> // #include <ext/pb_ds/assoc_container.hpp> // #include <ext/pb_ds/tree_policy.hpp> // using namespace __gnu_pbds; // #define ordered_set tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> // #pragma GCC optimize("O3,unroll-loops") // #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") using namespace std; typedef long long ll; typedef long double ldb; typedef vector<int> vi; typedef vector<long long> vl; typedef vector<double> vdb; typedef vector<vector<int>> vvi; typedef vector<vector<ll>> vvl; typedef vector<string> vs; typedef set<int> si; typedef set<long long> sl; typedef set<double> sdb; typedef set<string> ss; typedef set<char> sc; typedef pair<int, int> pii; typedef pair<ll, ll> pll; #define ftb(i, a, b) for (int i = a, _b = b; i <= _b; ++i) #define ft(i, a, b) for (int i = a, _b = b; i < _b; ++i) #define fgb(i, a, b) for (int i = a, _b = b; i >= _b; --i) #define fg(i, a, b) for (int i = a, _b = b; i > _b; --i) #define endl "\n" const int N = 20000; bool dp[N + 1]; int main() { ios::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); int n, m; cin >> n >> m; vi a(n), c(m); ft(i, 0, n) { cin >> a[i]; } ft(i, 0, m) { cin >> c[i]; } dp[0] = true; if (n != 1) { cout << "NO" << endl; return 0; } for (int it : a) { vi tmp; ftb(i, 1, N) { if (i - it < 0) continue; if (dp[i - it]) { tmp.push_back(i); } } for (int v : tmp) { dp[v] = true; } } if (dp[a[0]]) { cout << "YES" << endl; } else cout << "NO" << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...