Submission #928666

# Submission time Handle Problem Language Result Execution time Memory
928666 2024-02-17T01:16:06 Z 12345678 Ice Hockey World Championship (CEOI15_bobek) C++17
100 / 100
426 ms 10696 KB
#include <bits/stdc++.h>

using namespace std;

#define ll long long

const int nx=42;
ll n, v[nx], m, h, res;
vector<ll> s;

int main()
{
    cin.tie(NULL)->sync_with_stdio(false);
    cin>>n>>m;
    for (int i=0; i<n; i++) cin>>v[i];
    h=n/2;
    for (int i=0; i<(1<<h); i++)
    {
        ll sm=0;
        for (int j=0; j<h; j++) if (i&(1<<j)) sm+=v[j];
        s.push_back(sm);
    }
    sort(s.begin(), s.end());
    //for (auto x:s) cout<<x<<'\n';
    for (int i=0; i<(1<<(n-h)); i++)
    {
        ll sm=0;
        for (int j=0; j<(n-h); j++) if (i&(1<<j)) sm+=v[h+j];
        //cout<<sm<<'\n';
        if (sm<=m) res+=(upper_bound(s.begin(), s.end(), m-sm)-s.begin());
    }
    cout<<res;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 504 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 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 1 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 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 1 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 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 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 27 ms 992 KB Output is correct
2 Correct 85 ms 2520 KB Output is correct
3 Correct 400 ms 10400 KB Output is correct
4 Correct 84 ms 2520 KB Output is correct
5 Correct 13 ms 992 KB Output is correct
6 Correct 6 ms 736 KB Output is correct
7 Correct 12 ms 992 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 36 ms 1500 KB Output is correct
2 Correct 28 ms 992 KB Output is correct
3 Correct 166 ms 5700 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 6 ms 736 KB Output is correct
6 Correct 13 ms 992 KB Output is correct
7 Correct 12 ms 992 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 61 ms 1500 KB Output is correct
2 Correct 137 ms 2520 KB Output is correct
3 Correct 130 ms 2520 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 78 ms 2560 KB Output is correct
6 Correct 221 ms 10696 KB Output is correct
7 Correct 66 ms 2520 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 297 ms 5076 KB Output is correct
2 Correct 25 ms 992 KB Output is correct
3 Correct 9 ms 736 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 6 ms 736 KB Output is correct
6 Correct 162 ms 5764 KB Output is correct
7 Correct 12 ms 992 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 27 ms 992 KB Output is correct
2 Correct 80 ms 2516 KB Output is correct
3 Correct 9 ms 736 KB Output is correct
4 Correct 8 ms 736 KB Output is correct
5 Correct 102 ms 2516 KB Output is correct
6 Correct 19 ms 992 KB Output is correct
7 Correct 203 ms 9668 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 353 ms 10440 KB Output is correct
2 Correct 29 ms 992 KB Output is correct
3 Correct 8 ms 732 KB Output is correct
4 Correct 426 ms 10692 KB Output is correct
5 Correct 123 ms 6352 KB Output is correct
6 Correct 14 ms 988 KB Output is correct
7 Correct 24 ms 1500 KB Output is correct