# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1121588 | vjudge1 | Ice Hockey World Championship (CEOI15_bobek) | C++17 | 347 ms | 8744 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;
typedef long long ll;
signed main(){
int n,m;
cin >> n >> m;
int aa;
if(n == 1){
cin >> aa;
cout << (aa > m ? 0 : 1);
return 0;
}
int hmm = 0;
vector<int> a(n/2),b(n - a.size());
for(auto &i : a){
cin >> i;
hmm += i;
}
for(auto &i : b){
cin >> i;
hmm += i;
}
vector<ll> cvbss;
for(int mask=0;mask<(1 << a.size());++mask){
ll curr=0;
for(int i=0;i<a.size();++i){
if(mask & (1 << i))curr += 1LL * a[i];
}
if(curr > m)continue;
else cvbss.push_back(curr);
}
sort(cvbss.begin(),cvbss.end());
ll cvb=0LL;
for(int mask=0;mask < (1 << b.size());++mask){
ll curr = 0;
for(int i=0;i<b.size();++i){
if(mask & (1 << i))curr += 1LL * b[i];
}
if(curr > m)continue;
else cvb = cvb + (upper_bound(cvbss.begin(),cvbss.end(),m - curr) - cvbss.begin());
}
cout << cvb;
}
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... |