# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1005070 | 2024-06-22T06:57:28 Z | Essa2006 | Ice Hockey World Championship (CEOI15_bobek) | C++14 | 109 ms | 20772 KB |
#include<bits/stdc++.h> using namespace std; #define ll long long #define endl '\n' #define FF first #define SS second #define all(a) a.begin(), a.end() #define mod (ll)(1000000007) int main() { ios_base::sync_with_stdio(0);cin.tie(0); int n; ll m; cin >> n >> m; vector<ll> C(n); for (int i = 0; i < n; i++) { cin >> C[i]; } array<int, 2> sz = {n / 2, (n + 1) / 2}; vector<vector<ll>> A(2); for (int j = 0; j < 2; j++) { int shift = (j ? sz[j - 1] : 0); for (int msk = 1; msk < (1 << sz[j]); msk++) { int cur = msk; A[j].push_back(C[63 - __builtin_clzll (msk) + shift]); cur = (cur & (cur - 1)); while (cur) { A[j].back() += (C[63 - __builtin_clzll(cur) + shift]); cur = (cur & (cur - 1)); } } } ll ans = 0; sort(all(A[1])); A[0].push_back(0); for (int i = 0; i < A[0].size(); i++) { if (A[0][i] > m) { continue; } ans++; int ind = upper_bound(all(A[1]), m - A[0][i]) - A[1].begin(); ans += ind; } cout << ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 600 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 | 0 ms | 348 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 8 ms | 2144 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 12 ms | 3032 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 18 ms | 3676 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 82 ms | 14552 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 9 ms | 2144 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 109 ms | 20772 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |