Submission #606859

#TimeUsernameProblemLanguageResultExecution timeMemory
606859HanksburgerIce Hockey World Championship (CEOI15_bobek)C++17
100 / 100
424 ms8660 KiB
#include <bits/stdc++.h> using namespace std; long long a[45], n, m, ans; vector<long long> v; void f(int l, int r, long long s) { if (l>r) { if (r==n/2) v.push_back(s); else ans+=upper_bound(v.begin(), v.end(), m-s)-v.begin(); return; } f(l+1, r, s); f(l+1, r, s+a[l]); } int main() { ios::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> m; for (int i=1; i<=n; i++) cin >> a[i]; f(1, n/2, 0); sort(v.begin(), v.end()); f(n/2+1, n, 0); cout << ans; 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...