Submission #494867

#TimeUsernameProblemLanguageResultExecution timeMemory
494867SirCovidThe19thIce Hockey World Championship (CEOI15_bobek)C++17
100 / 100
362 ms20784 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long void go(int n, vector<ll> &vals){ ll A[n]; for (ll &i : A) cin >> i; for (int i = 0; i < (1 << n); i++){ ll sm = 0; for (int j = 0; j < n; j++) if ((i >> j) & 1) sm += A[j]; vals.push_back(sm); } sort(vals.begin(), vals.end()); } int main(){ int N; ll M; cin >> N >> M; vector<ll> X, Y; go(N / 2, X); go(N - N / 2, Y); ll ans = 0; for (ll i : X) ans += upper_bound(Y.begin(), Y.end(), M - i) - Y.begin(); cout<<ans<<endl; }
#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...