# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1085760 | 2024-09-08T16:09:23 Z | juicy | Ice Hockey World Championship (CEOI15_bobek) | C++17 | 270 ms | 20768 KB |
#include <bits/stdc++.h> using namespace std; #ifdef LOCAL #include "debug.h" #else #define debug(...) 42 #endif int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; long long k; cin >> n >> k; vector<long long> a(n); for (int i = 0; i < n; ++i) { cin >> a[i]; } vector<long long> lt, rt; for (int m = 0; m < (1 << n / 2); ++m) { long long sum = 0; for (int i = 0; i < n / 2; ++i) { if (m >> i & 1) { sum += a[i]; } } lt.push_back(sum); } for (int m = 0; m < (1 << n - n / 2); ++m) { long long sum = 0; for (int i = 0; i < n - n / 2; ++i) { if (m >> i & 1) { sum += a[n / 2 + i]; } } rt.push_back(sum); } sort(lt.rbegin(), lt.rend()); sort(rt.begin(), rt.end()); int j = 0; __int128_t res = 0; for (auto x : lt) { while (j < rt.size() && rt[j] + x <= k) { ++j; } res += j; } while (res) { int x = res % 10; cout << x; res /= 10; } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 23 ms | 2144 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 30 ms | 3032 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 52 ms | 3676 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 207 ms | 12868 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 24 ms | 2144 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 270 ms | 20768 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |