# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
971382 | Sunbae | Ice Hockey World Championship (CEOI15_bobek) | C++17 | 387 ms | 10684 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>
typedef long long ll;
using namespace std;
const int N = 44;
vector<ll> v, a1, a2;
signed main(){
int n; ll m; scanf("%d %lld", &n, &m);
int k = n/2;
for(int i = 0; i<k; ++i){
ll x; scanf("%lld", &x); a1.push_back(x);
}
for(int i = k; i<n; ++i){
ll x; scanf("%lld", &x); a2.push_back(x);
}
int sz1 = a1.size(), sz2 = a2.size();
for(int mask = 0; mask < (1<<sz1); ++mask){
ll sum = 0;
for(int i = 0; i<sz1; ++i) if(mask>>i&1) sum += a1[i];
v.push_back(sum);
}
sort(v.begin(), v.end());
ll cnt = 0;
for(int mask = 0; mask < (1<<sz2); ++mask){
ll sum = 0;
for(int i = 0; i<sz2; ++i) if(mask>>i&1) sum += a2[i];
cnt += upper_bound(v.begin(), v.end(), m - sum) - v.begin();
}
printf("%lld", cnt);
}
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... |