# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1028260 | 2024-07-19T15:39:50 Z | lmao123456 | Ice Hockey World Championship (CEOI15_bobek) | C++14 | 221 ms | 20916 KB |
#include <bits/stdc++.h> using namespace std; #define int long long vector<int> df(vector<int> v) { int n = v.size(); vector<int> res; for(int mask = 0; mask < (1 << n); mask++) { int sum = 0; for(int i = 0; i < n; i++) { sum += ((mask >> 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 as = n / 2; int bs = n - as; vector<int> a = v; a.resize(as); vector<int> b = v; reverse(b.begin(), b.end()); b.resize(bs); 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() { ios_base::sync_with_stdio(false); cin.tie(nullptr); 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 | 0 ms | 344 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 | 344 KB | Output is correct |
6 | Correct | 0 ms | 348 KB | Output is correct |
7 | 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 | 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 | 0 ms | 348 KB | Output is correct |
7 | 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 | 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 | 0 ms | 348 KB | Output is correct |
7 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 13 ms | 1888 KB | Output is correct |
2 | Correct | 43 ms | 5476 KB | Output is correct |
3 | Correct | 195 ms | 20836 KB | Output is correct |
4 | Correct | 45 ms | 5576 KB | Output is correct |
5 | Correct | 6 ms | 1500 KB | Output is correct |
6 | Correct | 4 ms | 1116 KB | Output is correct |
7 | Correct | 9 ms | 1756 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 19 ms | 3032 KB | Output is correct |
2 | Correct | 15 ms | 1956 KB | Output is correct |
3 | Correct | 69 ms | 10692 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 3 ms | 1116 KB | Output is correct |
6 | Correct | 9 ms | 1756 KB | Output is correct |
7 | Correct | 10 ms | 1628 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 30 ms | 3676 KB | Output is correct |
2 | Correct | 68 ms | 6744 KB | Output is correct |
3 | Correct | 64 ms | 6728 KB | Output is correct |
4 | Correct | 1 ms | 348 KB | Output is correct |
5 | Correct | 35 ms | 6624 KB | Output is correct |
6 | Correct | 152 ms | 20916 KB | Output is correct |
7 | Correct | 68 ms | 6744 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 138 ms | 12860 KB | Output is correct |
2 | Correct | 18 ms | 2144 KB | Output is correct |
3 | Correct | 5 ms | 992 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 3 ms | 992 KB | Output is correct |
6 | Correct | 130 ms | 12764 KB | Output is correct |
7 | Correct | 10 ms | 1500 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 1888 KB | Output is correct |
2 | Correct | 44 ms | 5460 KB | Output is correct |
3 | Correct | 5 ms | 992 KB | Output is correct |
4 | Correct | 5 ms | 992 KB | Output is correct |
5 | Correct | 39 ms | 6744 KB | Output is correct |
6 | Correct | 15 ms | 2012 KB | Output is correct |
7 | Correct | 175 ms | 20828 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 185 ms | 20816 KB | Output is correct |
2 | Correct | 15 ms | 2144 KB | Output is correct |
3 | Correct | 5 ms | 1116 KB | Output is correct |
4 | Correct | 221 ms | 20812 KB | Output is correct |
5 | Correct | 52 ms | 10688 KB | Output is correct |
6 | Correct | 10 ms | 1756 KB | Output is correct |
7 | Correct | 19 ms | 2908 KB | Output is correct |