제출 #1118007

#제출 시각아이디문제언어결과실행 시간메모리
1118007kirakosyan은행 (IZhO14_bank)C++17
19 / 100
1 ms504 KiB
#include<algorithm> #include<iostream> #include<vector> #include<string> #include<random> #include<cmath> #include<stack> #include<map> #include <iomanip> #include <queue> #include <set> using namespace std; using ll = long long; using ull = unsigned long long; ll mod = 1e9 + 7; ll pv(ll a, ll b) { if (b == 0)return 1; ll res = (pv(a, b / 2)); if (b % 2) { return (((res * res) % mod) * (a % mod)) % mod; } else { return (res * res) % mod; } } void solve() { int n, m; cin >> n >> m; int ap; cin >> ap; vector<int>v(m),dp(10000); for (int i = 0; i < m; i++)cin >> v[i]; dp[0] = 1; for (int i = 0; i < m; i++) { for (int j = 1000; j >= v[i]; j--) { if (dp[j - v[i]] == 1)dp[j] = 1; } } //cout << dp[6] << endl; if (dp[ap])cout << "YES" << endl; else cout << "NO" << endl; } signed main() { ios_base::sync_with_stdio(false); cin.tie(NULL); cin.tie(nullptr); ll _ = 1; //cin >> _; while (_--) { solve(); } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...