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