# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1005201 | 2024-06-22T08:44:56 Z | Valaki2 | Ice Hockey World Championship (CEOI15_bobek) | C++14 | 192 ms | 22452 KB |
#include <bits/stdc++.h> using namespace std; #define int long long #define pb push_back #define mp make_pair #define pii pair<int, int> #define fi first #define se second vector<int> do_for(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.pb(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 << "1\n"; } else { cout << "0\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 = do_for(a); vector<int> y = do_for(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 | Incorrect | 0 ms | 344 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 344 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 | 0 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 604 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 | 452 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 | 14 ms | 2024 KB | Output is correct |
2 | Correct | 42 ms | 5464 KB | Output is correct |
3 | Correct | 164 ms | 22452 KB | Output is correct |
4 | Correct | 43 ms | 5576 KB | Output is correct |
5 | Correct | 6 ms | 1500 KB | Output is correct |
6 | Correct | 4 ms | 992 KB | Output is correct |
7 | Correct | 9 ms | 1636 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 18 ms | 3028 KB | Output is correct |
2 | Correct | 13 ms | 2016 KB | Output is correct |
3 | Correct | 67 ms | 11716 KB | Output is correct |
4 | Correct | 0 ms | 344 KB | Output is correct |
5 | Correct | 3 ms | 1116 KB | Output is correct |
6 | Correct | 10 ms | 1632 KB | Output is correct |
7 | Correct | 11 ms | 1752 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 29 ms | 3672 KB | Output is correct |
2 | Correct | 64 ms | 7000 KB | Output is correct |
3 | Correct | 58 ms | 7164 KB | Output is correct |
4 | Correct | 1 ms | 344 KB | Output is correct |
5 | Correct | 34 ms | 7252 KB | Output is correct |
6 | Correct | 134 ms | 21348 KB | Output is correct |
7 | Correct | 62 ms | 8260 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 134 ms | 14664 KB | Output is correct |
2 | Correct | 14 ms | 2144 KB | Output is correct |
3 | Correct | 5 ms | 1116 KB | Output is correct |
4 | Correct | 0 ms | 348 KB | Output is correct |
5 | Correct | 3 ms | 1116 KB | Output is correct |
6 | Correct | 129 ms | 13260 KB | Output is correct |
7 | Correct | 9 ms | 1756 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 15 ms | 2144 KB | Output is correct |
2 | Correct | 41 ms | 5368 KB | Output is correct |
3 | Correct | 5 ms | 1348 KB | Output is correct |
4 | Correct | 5 ms | 1056 KB | Output is correct |
5 | Correct | 37 ms | 8532 KB | Output is correct |
6 | Correct | 15 ms | 2140 KB | Output is correct |
7 | Correct | 168 ms | 21688 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 192 ms | 22356 KB | Output is correct |
2 | Correct | 13 ms | 2144 KB | Output is correct |
3 | Correct | 4 ms | 1116 KB | Output is correct |
4 | Correct | 178 ms | 21080 KB | Output is correct |
5 | Correct | 45 ms | 10696 KB | Output is correct |
6 | Correct | 8 ms | 1500 KB | Output is correct |
7 | Correct | 18 ms | 2888 KB | Output is correct |