This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
#define int long long
#define lowval(x) (x & (-x))
#define lowind __builtin_ctzll
using namespace std;
const int MAXN = 20 + 3;
int n, m, c[MAXN], dp[(1 << MAXN)], ans;
int32_t main() {
cin >> n >> m;
if (n >= MAXN) return 0;
for (int i = 0; i < n; i++) cin >> c[i];
for (int i = 1; i < (1 << n); i++) if ((dp[i] = c[lowind(i)] + dp[i - lowval(i)]) <= m) ans++;
cout << ans + 1;
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |