# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
93343 | RezwanArefin01 | Ice Hockey World Championship (CEOI15_bobek) | C++17 | 354 ms | 20844 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
///usr/bin/g++ -O2 $0 -o ${0%.cpp} && echo "----------" && ./${0%.cpp}; exit;
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<int, int> ii;
const int N = 50;
int n; ll X;
vector<ll> a, b;
void gen(int i, vector<ll> &a, vector<ll> &A, ll S = 0) {
if(S > X) return;
if(i == a.size()) { A.push_back(S); return; }
gen(i + 1, a, A, S + a[i]);
gen(i + 1, a, A, S);
}
int main() {
scanf("%d %lld", &n, &X);
vector<ll> a, b;
for(int i = 0; i < n; i++) {
ll x; scanf("%lld", &x);
if(i < n / 2) a.push_back(x);
else b.push_back(x);
}
vector<ll> A, B;
gen(0, a, A);
gen(0, b, B);
sort(A.begin(), A.end());
ll ans = 0;
for(ll Y : B) ans += lower_bound(A.begin(), A.end(), X - Y + 1) - A.begin();
printf("%lld\n", ans);
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |