Submission #941839

# Submission time Handle Problem Language Result Execution time Memory
941839 2024-03-09T14:48:40 Z maxFedorchuk Ice Hockey World Championship (CEOI15_bobek) C++17
100 / 100
289 ms 10700 KB
#include <bits/stdc++.h>
using namespace std;

vector < long long > vr1;
long long a[44];
long long ans,n,k;

void cnt1(long long zr,long long sm)
{
    if(zr==(n/2+1))
    {
        vr1.push_back(sm);
        return;
    }

    cnt1(zr+1,sm+a[zr]);
    cnt1(zr+1,sm);
}

void cnt2(long long zr,long long sum)
{
    if(zr==n+1)
    {
        ans+=(upper_bound(vr1.begin(),vr1.end(),k-sum)-vr1.begin());
        return;
    }

    cnt2(zr+1,sum+a[zr]);
    cnt2(zr+1,sum);
}

int main()
{
    cin.tie(0);
    ios_base::sync_with_stdio(0);

    cin>>n>>k;

    for(long long i=1;i<=n;i++)
    {
        cin>>a[i];
    }

    cnt1(1,0);
    sort(vr1.begin(),vr1.end());
    cnt2(n/2+1,0);

    cout<<ans<<"\n";
    return 0;
}
# 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 600 KB Output is correct
2 Correct 0 ms 456 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 456 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 456 KB Output is correct
3 Correct 1 ms 460 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 344 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 344 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 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 Correct 18 ms 992 KB Output is correct
2 Correct 62 ms 2520 KB Output is correct
3 Correct 274 ms 9424 KB Output is correct
4 Correct 58 ms 2516 KB Output is correct
5 Correct 5 ms 988 KB Output is correct
6 Correct 4 ms 856 KB Output is correct
7 Correct 7 ms 1100 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 25 ms 1500 KB Output is correct
2 Correct 18 ms 1104 KB Output is correct
3 Correct 112 ms 4624 KB Output is correct
4 Correct 0 ms 344 KB Output is correct
5 Correct 2 ms 736 KB Output is correct
6 Correct 6 ms 1096 KB Output is correct
7 Correct 5 ms 992 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 47 ms 1496 KB Output is correct
2 Correct 100 ms 2520 KB Output is correct
3 Correct 102 ms 2516 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 24 ms 2520 KB Output is correct
6 Correct 94 ms 9168 KB Output is correct
7 Correct 27 ms 2516 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 204 ms 5332 KB Output is correct
2 Correct 17 ms 992 KB Output is correct
3 Correct 6 ms 736 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 3 ms 824 KB Output is correct
6 Correct 66 ms 5328 KB Output is correct
7 Correct 6 ms 992 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 19 ms 992 KB Output is correct
2 Correct 58 ms 2520 KB Output is correct
3 Correct 5 ms 736 KB Output is correct
4 Correct 5 ms 736 KB Output is correct
5 Correct 31 ms 2520 KB Output is correct
6 Correct 7 ms 992 KB Output is correct
7 Correct 104 ms 8940 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 242 ms 10700 KB Output is correct
2 Correct 20 ms 992 KB Output is correct
3 Correct 6 ms 736 KB Output is correct
4 Correct 289 ms 9420 KB Output is correct
5 Correct 42 ms 5332 KB Output is correct
6 Correct 6 ms 988 KB Output is correct
7 Correct 11 ms 1500 KB Output is correct