Submission #1005035

#TimeUsernameProblemLanguageResultExecution timeMemory
1005035ereringIce Hockey World Championship (CEOI15_bobek)C++17
100 / 100
255 ms10192 KiB
#include <bits/stdc++.h> using namespace std; #define endl '\n' #define pb push_back #define ll long long #define int long long const long long inf=1e18; const int MOD=1e9+7; const int N=41; int a[N],n,m,ans=0; bool flag=0; vector<int> v; void func(int i,int score){ if(flag && i==n/2){ auto it=upper_bound(v.begin(),v.end(),m-score)-v.begin(); ans+=it; return; } if(i==n){ v.pb(score); return; } func(i+1,score); if(score+a[i]<=m)func(i+1,score+a[i]); } signed main() { ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); cin>>n>>m; for(int i=0;i<n;i++)cin>>a[i]; func(n/2,0); flag=1; sort(v.begin(),v.end()); func(0,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...