# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1028240 | 2024-07-19T15:31:35 Z | vjudge1 | Ice Hockey World Championship (CEOI15_bobek) | C++14 | 64 ms | 10664 KB |
#include <bits/stdc++.h> using namespace std; vector<int> df(vector<int> v) { int n = v.size(); vector<int> res; for(int j = 0; j < (1 << n); j++) { int sum = 0; for(int i = 0; i < n; i++) { sum += ((j >> i) & 1) * v[i]; } res.push_back(sum); } sort(res.begin(), res.end()); return res; } void solve() { int n, m; cin >> n >> m; vector<int> v(n); for(int i = 0; i < n; i++) { cin >> v[i]; } if(n == 1) { if(v[0] <= m) { cout << "2" << "\n"; } else { cout << "1" << "\n"; } return; } int a1 = n / 2; int b1 = n - a1; vector<int> a = v; a.resize(a1); vector<int> b = v; reverse(b.begin(), b.end()); b.resize(b1); reverse(b.begin(), b.end()); vector<int> x = df(a); vector<int> y = df(b); reverse(y.begin(), y.end()); int ans = 0; int idx = 0; for(int cur : x) { while(idx < y.size() && cur + y[idx] > m) { idx++; } ans += y.size() - idx; } cout << ans << "\n"; } signed main() { solve(); }
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 | 1 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 348 KB | Output is correct |
3 | Correct | 1 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 | 0 ms | 348 KB | Output is correct |
7 | 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 | 1 ms | 432 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 14 ms | 1116 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 19 ms | 1492 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 33 ms | 1880 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 53 ms | 6596 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 6 ms | 1116 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 64 ms | 10664 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |