# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1121558 | vjudge1 | Ice Hockey World Championship (CEOI15_bobek) | C++17 | 392 ms | 8816 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.
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define inf 0x3F3F3F3F
signed main()
{
ios_base::sync_with_stdio(0);
cin.tie(0);
int n, m;
cin >> n >> m;
vector<int> a;
vector<int> v1, v2;
int x[n];
for (int &i : x) cin >> i;
for (int i = 0; i < n; i++)
{
if (i < 20) v1.push_back(x[i]);
else v2.push_back(x[i]);
}
for (int i = 0; i < (1 << (int)v1.size()); i++)
{
int s = 0;
for (int j = 0; j < v1.size(); j++)
{
if (i >> j & 1) s += v1[j];
}
a.push_back(s);
}
sort(a.begin(), a.end());
int res = 0;
for (int i = 0; i < (1 << (int)v2.size()); i++)
{
int s = 0;
for (int j = 0; j < v2.size(); j++)
{
if (i >> j & 1) s += v2[j];
}
res += upper_bound(a.begin(), a.end(), m - s) - a.begin();
}
cout << res << '\n';
}
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... |