# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
935090 | ind1v | Ice Hockey World Championship (CEOI15_bobek) | C++11 | 417 ms | 10548 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;
int n;
long long m;
vector<long long> c;
vector<long long> a, b;
vector<long long> c1;
int main() {
ios::sync_with_stdio(false);
cin.tie(0);
cin >> n >> m;
c.resize(n);
for (int i = 0; i < n; i++) {
cin >> c[i];
}
for (int i = 0; i < n / 2; i++) {
a.emplace_back(c.back());
c.pop_back();
}
while (!c.empty()) {
b.emplace_back(c.back());
c.pop_back();
}
for (int msk = 0; msk < (1 << a.size()); msk++) {
long long s = 0;
for (int i = 0; i < a.size(); i++) {
if (msk >> i & 1) {
s += a[i];
}
}
c1.emplace_back(s);
}
sort(c1.begin(), c1.end());
long long ans = 0;
for (int msk = 0; msk < (1 << b.size()); msk++) {
long long s = 0;
for (int i = 0; i < b.size(); i++) {
if (msk >> i & 1) {
s += b[i];
}
}
ans += (upper_bound(c1.begin(), c1.end(), m - s) - c1.begin());
}
cout << ans << '\n';
return 0;
}
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... |