Submission #867259

#TimeUsernameProblemLanguageResultExecution timeMemory
867259Muhammad_AneeqIce Hockey World Championship (CEOI15_bobek)C++17
40 / 100
1098 ms456 KiB
/* بسم الله الرحمن الرحيم Author: (:Muhammad Aneeq:) */ #pragma GCC optimize("O2") #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") #include <iostream> #include <map> #include <algorithm> #define int long long using namespace std; int n,m; int ans=1; int const N=45; int a[N]; int dfs(int i,int s,bool w=0) { if (s>m) return 0; if (i==n) return (s<=m&&w); return (dfs(i+1,s)+dfs(i+1,s+a[i],1)+w); } inline void solve() { cin>>n>>m; int x=0; for (int i=0;i<n;i++) { cin>>a[i]; x+=a[i]; } if (x<=m) { int z=1; for (int i=0;i<n;i++) { z*=2; } cout<<z<<endl;return; } sort(a,a+n); cout<<dfs(0,0,1)<<endl; } signed main() { ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); solve(); }
#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...