# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
867390 | Muhammad_Aneeq | Ice Hockey World Championship (CEOI15_bobek) | C++17 | 363 ms | 16860 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.
/*
بسم الله الرحمن الرحيم
Author:
(:Muhammad Aneeq:)
*/
#pragma GCC optimize("O2")
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
#define int long long
inline void solve()
{
int n,K;
cin>>n>>K;
int a[n];
for (auto& i:a)
cin>>i;
vector<int>x((1<<(n/2))),y(1<<(n-n/2));
for (int i=0;i<=x.size();++i)
{
int z=0;
for (int j=0;j<n/2;j++)
{
if ((1<<j)&i)
z+=a[j];
}
x[i]=z;
}
for (int i=0;i<=y.size();i++)
{
int z=0;
for (int j=0;j<n-n/2;j++)
{
if ((1<<j)&i)
z+=a[n/2+j];
}
y[i]=z;
}
sort(x.begin(), x.end());
int ans=0;
for (auto i:y)
{
int z=upper_bound(x.begin(), x.end(),K-i)-begin(x);
ans+=z;
}
cout<<ans<<endl;
}
signed main()
{
ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
solve();
}
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... |