# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1121525 | vjudge1 | Ice Hockey World Championship (CEOI15_bobek) | C++17 | 479 ms | 8768 KiB |
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"
using namespace std;
using ll = long long;
const int mxN = 40;
int a[mxN];
main() {
int N;
ll M;
cin >> N >> M;
for (int i = 0; i < N; i ++) {
cin >> a[i];
}
int firstHalf = N / 2;
vector<ll> poss;
for (int i = 0; i < (1 << firstHalf); i ++) {
ll sm = 0;
for (int j = 0; j < firstHalf; j ++) {
if ((i >> j) & 1) {
sm += a[j];
}
}
poss.push_back(sm);
}
sort(begin(poss),end(poss));
int secondHalf = N - firstHalf;
ll ans = 0;
for (int i = 0; i < (1 << secondHalf); i ++) {
ll sm = 0;
for (int j = 0; j < secondHalf; j ++) {
if ((i >> j) & 1) {
sm += a[firstHalf + j];
}
}
ans += upper_bound(begin(poss),end(poss),M - sm) - begin(poss);
}
cout << ans << endl;
}
Compilation message (stderr)
# | 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... |