# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
101756 | shenxy | Ice Hockey World Championship (CEOI15_bobek) | C++11 | 571 ms | 8672 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 <cstdio>
#include <algorithm>
#include <vector>
using namespace std;
int main() {
int N;
long long int M;
scanf("%d %lld", &N, &M);
long long int mycosts[N];
for (int i = 0; i < N; i++) scanf("%lld", &mycosts[i]);
vector<long long int> thecosts;
for (long long int mask = 0; mask < (1 << (N / 2)); mask++) {
long long int ans = 0;
for (int i = 0; i < N / 2; i++) {
if (mask & (1 << i)) ans += mycosts[i];
}
thecosts.push_back(ans);
}
sort(thecosts.begin(), thecosts.end());
long long int trueans = 0;
for (long long int mask = 0; mask < (1 << (N - N / 2)); mask++) {
long long int ans = 0;
for (int i = 0; i < N - N / 2; i++) {
if (mask & (1 << i)) ans += mycosts[N / 2 + i];
}
trueans += upper_bound(thecosts.begin(), thecosts.end(), M - ans) - thecosts.begin();
}
printf("%lld", trueans);
return 0;
}
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... |