# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
124222 | kimbj0709 | Ice Hockey World Championship (CEOI15_bobek) | C++17 | 615 ms | 20972 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 unsigned long long int ull;
int main() {
ull no_of_input,input,sum;
ull total = 0;
ull count = 0;
vector<ull> vect1;
vector<ull> vect2;
vector<ull> vect3;
vector<ull> vect4;
cin >> no_of_input >> sum;
for(int i=0;i<no_of_input;i++){
cin >> input;
if(i%2==0){
vect1.push_back(input);
}
else{
vect3.push_back(input);
}
}
for(int i=0;i<pow(2,vect1.size());i++){
for(int j=0;j<vect1.size();j++){
if(i & (1<<j)){
count += vect1[j];
}
}
vect2.push_back(count);
count = 0;
}
for(int i=0;i<pow(2,vect3.size());i++){
for(int j=0;j<vect3.size();j++){
if(i & (1<<j)){
count += vect3[j];
}
}
vect4.push_back(count);
count = 0;
}
sort(vect2.begin(),vect2.end());
sort(vect4.begin(),vect4.end());
for(int i=0;i<vect2.size();i++){
if(sum>=vect2[i]){
total += upper_bound(vect4.begin(),vect4.end(),(sum-vect2[i]))-vect4.begin();
//cout << total << "\n";
}
}
cout << total;
}
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... |