# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
462012 | 2021-08-10T07:06:42 Z | kingfran1907 | Ice Hockey World Championship (CEOI15_bobek) | C++14 | 484 ms | 8636 KB |
#include <bits/stdc++.h> #define X first #define Y second using namespace std; typedef long long llint; const int maxn = 2e5+10; const int base = 31337; const int mod = 1e9+7; const int inf = 0x3f3f3f3f; const int logo = 18; const int off = 1 << logo; const int treesiz = off << 1; int n; llint m; llint niz[maxn]; vector< llint > v; int main() { scanf("%d%lld", &n, &m); for (int i = 0; i < n; i++) scanf("%lld", niz+i); int hf = n / 2; int lim = (1 << hf); for (int mask = 0; mask < lim; mask++) { llint sum = 0; for (int i = 0; i < hf; i++) if (mask & (1 << i)) sum += niz[i]; v.push_back(sum); } sort(v.begin(), v.end()); llint sol = 0; lim = (1 << (n - hf)); for (int mask = 0; mask < lim; mask++) { llint sum = 0; for (int i = 0; i < n - hf; i++) { if (mask & (1 << i)) sum += niz[i]; } int ind = upper_bound(v.begin(), v.end(), m - sum) - v.begin(); sol += ind; } printf("%lld\n", sol); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 204 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 35 ms | 840 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 37 ms | 1348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 64 ms | 1460 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 367 ms | 4548 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 33 ms | 840 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 484 ms | 8636 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |