Submission #977020

#TimeUsernameProblemLanguageResultExecution timeMemory
977020SeenSiravitIce Hockey World Championship (CEOI15_bobek)C++14
40 / 100
72 ms604 KiB
#include<bits/stdc++.h> #define ll long long using namespace std; const int mxN = 40 + 5; int n; ll m; ll a[mxN]; void bruteforce(){ ll ans = 0; ll lim = 1<<n; for(int mask=0;mask<lim;mask++){ ll sum = 0; for(int i=0;i<n;i++){ if((1<<i) & mask) sum += a[i]; if(sum > m) break; } if(sum <= m) ans++; } cout<< ans; } int main(){ ios::sync_with_stdio(0),cin.tie(0); cin>> n >> m; for(int i=0;i<n;i++) cin>> a[i]; bruteforce(); return 0; }
#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...