# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
975258 | 2024-05-04T15:59:11 Z | duckindog | Ice Hockey World Championship (CEOI15_bobek) | C++17 | 238 ms | 22496 KB |
#include <bits/stdc++.h> using namespace std; const int N = 40 + 10; int n; long long m; long long a[N], b[N]; int32_t main() { cin.tie(0)->sync_with_stdio(0); cin >> n >> m; vector<long long> first = {0}, second = {0}; { int x = (n + 1 >> 1), y = n - x; for (int i = 1; i <= x; ++i) cin >> a[i]; for (int i = 1; i <= y; ++i) cin >> b[i]; for (int bit = 1; bit < (1 << x); ++bit) { long long sum = 0; for (int j = 1; j <= x; ++j) sum += (bit >> j - 1 & 1) * a[j]; if (sum <= m) first.push_back(sum); } for (int bit = 1; bit < (1 << y); ++bit) { long long sum = 0; for (int j = 1; j <= y; ++j) sum += (bit >> j - 1 & 1) * b[j]; if (sum <= m) second.push_back(sum); } } sort(first.begin(), first.end()); sort(second.begin(), second.end()); long long answer = 0; for (const auto& x : first) answer += upper_bound(second.begin(), second.end(), m - x) - second.begin(); cout << answer << "\n"; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 1 ms | 348 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 504 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 1 ms | 344 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 0 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 1 ms | 344 KB | Output is correct |
3 | Correct | 1 ms | 600 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 1 ms | 348 KB | Output is correct |
6 | Correct | 0 ms | 452 KB | Output is correct |
7 | Correct | 1 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 17 ms | 2520 KB | Output is correct |
2 | Correct | 54 ms | 5588 KB | Output is correct |
3 | Correct | 238 ms | 22496 KB | Output is correct |
4 | Correct | 54 ms | 5588 KB | Output is correct |
5 | Correct | 8 ms | 1500 KB | Output is correct |
6 | Correct | 5 ms | 1116 KB | Output is correct |
7 | Correct | 2 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 24 ms | 3228 KB | Output is correct |
2 | Correct | 20 ms | 2264 KB | Output is correct |
3 | Correct | 82 ms | 11768 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 4 ms | 1116 KB | Output is correct |
6 | Correct | 11 ms | 1756 KB | Output is correct |
7 | Correct | 2 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 39 ms | 4564 KB | Output is correct |
2 | Correct | 88 ms | 8660 KB | Output is correct |
3 | Correct | 83 ms | 8656 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 44 ms | 8652 KB | Output is correct |
6 | Correct | 180 ms | 22176 KB | Output is correct |
7 | Correct | 11 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 183 ms | 16844 KB | Output is correct |
2 | Correct | 18 ms | 2264 KB | Output is correct |
3 | Correct | 6 ms | 1116 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 4 ms | 1116 KB | Output is correct |
6 | Correct | 162 ms | 16920 KB | Output is correct |
7 | Correct | 2 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 19 ms | 2520 KB | Output is correct |
2 | Correct | 52 ms | 5588 KB | Output is correct |
3 | Correct | 7 ms | 988 KB | Output is correct |
4 | Correct | 6 ms | 988 KB | Output is correct |
5 | Correct | 48 ms | 8656 KB | Output is correct |
6 | Correct | 17 ms | 2516 KB | Output is correct |
7 | Correct | 29 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 214 ms | 21440 KB | Output is correct |
2 | Correct | 20 ms | 2520 KB | Output is correct |
3 | Correct | 6 ms | 1116 KB | Output is correct |
4 | Correct | 231 ms | 21236 KB | Output is correct |
5 | Correct | 60 ms | 11472 KB | Output is correct |
6 | Correct | 11 ms | 1752 KB | Output is correct |
7 | Correct | 3 ms | 600 KB | Output is correct |