Submission #208178

#TimeUsernameProblemLanguageResultExecution timeMemory
208178Jalilvand_mJIce Hockey World Championship (CEOI15_bobek)C++14
100 / 100
544 ms8672 KiB
//HovalHaq! #include <bits/stdc++.h> using namespace std; typedef long long ll; int main() { int n; cin >> n; ll m, r = 0; cin >> m; vector<ll> A(n), X; for(int i = 0; i < n; i++) cin >> A[i]; int a = n / 2; for(int msk = 0; msk < (1 << a); msk++) { ll s = 0; for(int i = 0; i < a; i++) if(msk & (1 << i)) s += A[i]; if(s <= m) X.push_back(s); } sort(X.begin(), X.end()); for(int msk = 0; msk < (1 << (n - a)); msk++) { ll s = 0; for(int i = 0; i < n - a; i++) if(msk & (1 << i)) s += A[a + i]; r += upper_bound(X.begin(), X.end(), m - s) - X.begin(); } cout << r; }
#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...