Submission #1109819

# Submission time Handle Problem Language Result Execution time Memory
1109819 2024-11-07T17:17:14 Z SulA Ice Hockey World Championship (CEOI15_bobek) C++17
100 / 100
413 ms 10844 KB
#include <bits/stdc++.h>
using namespace std;
 
signed main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr); cout.tie(nullptr);
 
    long long n; long long x; cin >> n >> x;
    long long a1[n/2], a2[(n+1)/2];
    for (auto& y : a1) cin >> y;
    for (auto& y : a2) cin >> y;
    vector<long long> half;
 
    for (long long mask = 0; mask < 1 << (n/2); mask++) {
        long long sum = 0;
        for (long long i = 0; i < n/2; i++) {
            if (mask & (1 << i)) {
                sum += a1[i];
            }
        }
        half.push_back(sum);
    }
    sort(half.begin(), half.end());
 
    long long cnt = 0;
    for (long long mask = 0; mask < (1 << ((n+1)/2)); mask++) {
        long long sum = 0;
        for (long long i = 0; i < (n+1)/2; i++) {
            if (mask & (1 << i)) {
                sum += a2[i];
            }
        }
        cnt += upper_bound(half.begin(), half.end(), x - sum) - half.begin();
    }
    cout << cnt;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 456 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 504 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 1 ms 336 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 336 KB Output is correct
6 Correct 1 ms 336 KB Output is correct
7 Correct 1 ms 336 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 1148 KB Output is correct
2 Correct 93 ms 3548 KB Output is correct
3 Correct 391 ms 10684 KB Output is correct
4 Correct 86 ms 3464 KB Output is correct
5 Correct 13 ms 980 KB Output is correct
6 Correct 7 ms 848 KB Output is correct
7 Correct 14 ms 980 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 37 ms 1432 KB Output is correct
2 Correct 28 ms 980 KB Output is correct
3 Correct 177 ms 6592 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 7 ms 724 KB Output is correct
6 Correct 14 ms 980 KB Output is correct
7 Correct 14 ms 980 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 68 ms 1488 KB Output is correct
2 Correct 141 ms 3532 KB Output is correct
3 Correct 131 ms 3532 KB Output is correct
4 Correct 1 ms 504 KB Output is correct
5 Correct 74 ms 3532 KB Output is correct
6 Correct 210 ms 10836 KB Output is correct
7 Correct 70 ms 3532 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 300 ms 6600 KB Output is correct
2 Correct 24 ms 980 KB Output is correct
3 Correct 9 ms 724 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 7 ms 896 KB Output is correct
6 Correct 147 ms 6592 KB Output is correct
7 Correct 13 ms 980 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 27 ms 980 KB Output is correct
2 Correct 80 ms 3548 KB Output is correct
3 Correct 8 ms 1016 KB Output is correct
4 Correct 9 ms 724 KB Output is correct
5 Correct 91 ms 3788 KB Output is correct
6 Correct 18 ms 980 KB Output is correct
7 Correct 208 ms 10684 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 334 ms 10684 KB Output is correct
2 Correct 28 ms 980 KB Output is correct
3 Correct 9 ms 848 KB Output is correct
4 Correct 413 ms 10844 KB Output is correct
5 Correct 105 ms 6536 KB Output is correct
6 Correct 13 ms 1096 KB Output is correct
7 Correct 26 ms 1488 KB Output is correct