Submission #1110793

#TimeUsernameProblemLanguageResultExecution timeMemory
1110793aliyousefIce Hockey World Championship (CEOI15_bobek)C++17
100 / 100
338 ms10692 KiB
#include <bits/stdc++.h> using namespace std; #define endl '\n' using ll=long long; ll a[41]; vector<ll>v; int n; ll m; ll ans=0; void rec(int i,ll sm){ if(i==n/2){ v.push_back(sm); return; } rec(i+1,sm+a[i]);rec(i+1,sm); } void rec2(int i,ll sm){ if(i==n){ int idx=upper_bound(v.begin(),v.end(),m-sm)-v.begin(); ans+=idx; return; } rec2(i+1,sm+a[i]);rec2(i+1,sm); } signed main() { cin.tie(0)->sync_with_stdio(0); cin>>n>>m; for(int i=0;i<n;i++)cin>>a[i]; rec(0,0); sort(v.begin(),v.end()); rec2(n/2,0); cout<<ans; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...