# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
436338 | 2021-06-24T12:46:27 Z | iulia13 | Ice Hockey World Championship (CEOI15_bobek) | C++14 | 2 ms | 332 KB |
#include <bits/stdc++.h> using namespace std; const int N = 50; #define ll long long map <ll, ll> cate; map <ll, ll> dp; set <ll> s; ll v[N]; ll a[N], b[N]; int main() { ll n, m, nr, i, h, j, na, nb; cin >> n >> m; for (i = 0; i < n; i++) cin >> v[i]; h = n / 2; for (i = 0; i < (1 << h); i++) { for (j = 0; j < h; j++) if (i & (1 << j)) a[i] += v[j]; } na = (1 << h); sort(a, a + na); for (i = h; i < n; i++) v[i - h] = v[i]; h = n - h; for (i = 0; i < (1 << h); i++) { for (j = 0; j < h; j++) if (i & (1 << j)) b[i] += v[j]; } nb = (1 << h); sort(b, b + nb); na--; nb--; j = nb; ll ans = 0; for (i = 0; i <= na; i++) { while (b[j] + a[i] > m && j > -1) j--; ans += (j + 1); } cout << ans; 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 | Correct | 1 ms | 204 KB | Output is correct |
2 | Correct | 1 ms | 204 KB | Output is correct |
3 | Correct | 1 ms | 204 KB | Output is correct |
4 | Correct | 1 ms | 204 KB | Output is correct |
5 | Correct | 1 ms | 204 KB | Output is correct |
6 | Correct | 1 ms | 204 KB | Output is correct |
7 | Correct | 1 ms | 204 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 332 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 332 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 332 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 332 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 332 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 332 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 2 ms | 332 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Runtime error | 1 ms | 332 KB | Execution killed with signal 11 |
2 | Halted | 0 ms | 0 KB | - |