Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ░█████╗░██╗░░░██╗████████╗██╗░░██╗░█████╗░██████╗░ ░█████╗░███████╗ ████████╗██╗░░██╗██╗░██████╗
- // ██╔══██╗██║░░░██║╚══██╔══╝██║░░██║██╔══██╗██╔══██╗ ██╔══██╗██╔════╝ ╚══██╔══╝██║░░██║██║██╔════╝
- // ███████║██║░░░██║░░░██║░░░███████║██║░░██║██████╔╝ ██║░░██║█████╗░░ ░░░██║░░░███████║██║╚█████╗░
- // ██╔══██║██║░░░██║░░░██║░░░██╔══██║██║░░██║██╔══██╗ ██║░░██║██╔══╝░░ ░░░██║░░░██╔══██║██║░╚═══██╗
- // ██║░░██║╚██████╔╝░░░██║░░░██║░░██║╚█████╔╝██║░░██║ ╚█████╔╝██║░░░░░ ░░░██║░░░██║░░██║██║██████╔╝
- // ╚═╝░░╚═╝░╚═════╝░░░░╚═╝░░░╚═╝░░╚═╝░╚════╝░╚═╝░░╚═╝ ░╚════╝░╚═╝░░░░░ ░░░╚═╝░░░╚═╝░░╚═╝╚═╝╚═════╝░
- // ░█████╗░░█████╗░██████╗░███████╗ ██╗░██████╗
- // ██╔══██╗██╔══██╗██╔══██╗██╔════╝ ██║██╔════╝
- // ██║░░╚═╝██║░░██║██║░░██║█████╗░░ ██║╚█████╗░
- // ██║░░██╗██║░░██║██║░░██║██╔══╝░░ ██║░╚═══██╗
- // ╚█████╔╝╚█████╔╝██████╔╝███████╗ ██║██████╔╝
- // ░╚════╝░░╚════╝░╚═════╝░╚══════╝ ╚═╝╚═════╝░
- // ████████╗██╗░░██╗███████╗ ░██╗░░░░░░░██╗░█████╗░██████╗░░██████╗████████╗ ░█████╗░░█████╗░██████╗░███████╗██████╗░
- // ╚══██╔══╝██║░░██║██╔════╝ ░██║░░██╗░░██║██╔══██╗██╔══██╗██╔════╝╚══██╔══╝ ██╔══██╗██╔══██╗██╔══██╗██╔════╝██╔══██╗
- // ░░░██║░░░███████║█████╗░░ ░╚██╗████╗██╔╝██║░░██║██████╔╝╚█████╗░░░░██║░░░ ██║░░╚═╝██║░░██║██║░░██║█████╗░░██████╔╝
- // ░░░██║░░░██╔══██║██╔══╝░░ ░░████╔═████║░██║░░██║██╔══██╗░╚═══██╗░░░██║░░░ ██║░░██╗██║░░██║██║░░██║██╔══╝░░██╔══██╗
- // ░░░██║░░░██║░░██║███████╗ ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░░██║██████╔╝░░░██║░░░ ╚█████╔╝╚█████╔╝██████╔╝███████╗██║░░██║
- // ░░░╚═╝░░░╚═╝░░╚═╝╚══════╝ ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚═╝╚═════╝░░░░╚═╝░░░ ░╚════╝░░╚════╝░╚═════╝░╚══════╝╚═╝░░╚═╝
- // ░█████╗░███████╗ ████████╗██╗░░██╗███████╗ ░██╗░░░░░░░██╗░█████╗░██████╗░██╗░░░░░██████╗░
- // ██╔══██╗██╔════╝ ╚══██╔══╝██║░░██║██╔════╝ ░██║░░██╗░░██║██╔══██╗██╔══██╗██║░░░░░██╔══██╗
- // ██║░░██║█████╗░░ ░░░██║░░░███████║█████╗░░ ░╚██╗████╗██╔╝██║░░██║██████╔╝██║░░░░░██║░░██║
- // ██║░░██║██╔══╝░░ ░░░██║░░░██╔══██║██╔══╝░░ ░░████╔═████║░██║░░██║██╔══██╗██║░░░░░██║░░██║
- // ╚█████╔╝██║░░░░░ ░░░██║░░░██║░░██║███████╗ ░░╚██╔╝░╚██╔╝░╚█████╔╝██║░░██║███████╗██████╔╝
- // ░╚════╝░╚═╝░░░░░ ░░░╚═╝░░░╚═╝░░╚═╝╚══════╝ ░░░╚═╝░░░╚═╝░░░╚════╝░╚═╝░░╚═╝╚══════╝╚═════╝░
- // ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██╗░░░░░███████╗░█████╗░███╗░░██╗░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
- // ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░██║░░░░░██╔════╝██╔══██╗████╗░██║░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
- // █████╗█████╗█████╗█████╗█████╗█████╗█████╗█████╗██║░░░░░█████╗░░██║░░██║██╔██╗██║█████╗█████╗█████╗█████╗█████╗█████╗█████╗█████╗
- // ╚════╝╚════╝╚════╝╚════╝╚════╝╚════╝╚════╝╚════╝██║░░░░░██╔══╝░░██║░░██║██║╚████║╚════╝╚════╝╚════╝╚════╝╚════╝╚════╝╚════╝╚════╝
- // ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░███████╗███████╗╚█████╔╝██║░╚███║░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
- // ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░╚══════╝╚══════╝░╚════╝░╚═╝░░╚══╝░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
- #include <bits/stdc++.h>
- using namespace std;
- const int INF = 1e9;
- long long dp[100005];
- int main() {
- int n, m;
- cin >> n >> m;
- int a[n + 10];
- for (int i = 1; i <= n; ++i)
- cin >> a[i];
- sort(a + 1, a + 1 + n);
- dp[0] = 1;
- for (int i = 1; i <= n; ++i) {
- for (int j = m; j >= 0; --j)
- if (dp[j] == 1)
- dp[j + a[i]] = 1;
- }
- if (dp[m] == 1)
- cout << "YES\n";
- else
- cout << "NO\n";
- return 0;
- }
- // Ещё скажите что я не сам списал;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement