Submission #1110791

#TimeUsernameProblemLanguageResultExecution timeMemory
1110791aliyousefIce Hockey World Championship (CEOI15_bobek)C++17
20 / 100
42 ms6600 KiB
#include <bits/stdc++.h> using namespace std; #define endl '\n' using ll=long long; int a[41]; vector<int>v; int n,m; int ans=0; void rec(int i,int sm){ if(i==n/2){ v.push_back(sm); return; } rec(i+1,sm+a[i]);rec(i+1,sm); } void rec2(int i,int 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...