Submission #928663

#TimeUsernameProblemLanguageResultExecution timeMemory
92866312345678Ice Hockey World Championship (CEOI15_bobek)C++17
10 / 100
207 ms9668 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long const int nx=42; ll n, v[nx], m, h, res; vector<ll> s; int main() { cin.tie(NULL)->sync_with_stdio(false); cin>>n>>m; for (int i=0; i<n; i++) cin>>v[i]; h=n/2; for (int i=0; i<(1<<h); i++) { ll sm=0; for (int j=0; j<h; j++) if (i&(1<<j)) sm+=v[j]; s.push_back(sm); } sort(s.begin(), s.end()); //for (auto x:s) cout<<x<<'\n'; for (int i=0; i<(1<<(n-h)); i++) { ll sm=0; for (int j=0; j<h; j++) if (i&(1<<j)) sm+=v[h+j]; if (sm<=m) res+=(upper_bound(s.begin(), s.end(), res)-s.begin()); } cout<<res; }
#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...