Submission #759223

# Submission time Handle Problem Language Result Execution time Memory
759223 2023-06-15T21:23:50 Z sofija6 Ice Hockey World Championship (CEOI15_bobek) C++14
100 / 100
224 ms 20896 KB
#include <bits/stdc++.h>
#define ll long long
#define MAXN 50
using namespace std;
ll a[MAXN],m;
vector<ll> v1,v2;
void Solve(ll l,ll r,ll cur,ll pos,vector<ll> &v)
{
    if (pos>r)
    {
        v.push_back(cur);
        return;
    }
    Solve(l,r,cur,pos+1,v);
    Solve(l,r,cur+a[pos],pos+1,v);
}
int main()
{
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    ll n,ans=0;
    cin >> n >> m;
    for (ll i=1;i<=n;i++)
        cin >> a[i];
    Solve(1,n/2,0,1,v1);
    Solve(n/2+1,n,0,n/2+1,v2);
    sort(v1.begin(),v1.end());
    sort(v2.begin(),v2.end());
    for (auto i : v1)
    {
        auto it=upper_bound(v2.begin(),v2.end(),m-i);
        if (it==v2.begin())
                continue;
        it--;
        ans+=it-v2.begin()+1;
    }
    cout << ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 340 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 15 ms 2008 KB Output is correct
2 Correct 50 ms 5452 KB Output is correct
3 Correct 224 ms 20804 KB Output is correct
4 Correct 48 ms 5452 KB Output is correct
5 Correct 7 ms 1492 KB Output is correct
6 Correct 5 ms 856 KB Output is correct
7 Correct 10 ms 1492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 2896 KB Output is correct
2 Correct 16 ms 2008 KB Output is correct
3 Correct 77 ms 10568 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 3 ms 984 KB Output is correct
6 Correct 10 ms 1620 KB Output is correct
7 Correct 10 ms 1492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 38 ms 3540 KB Output is correct
2 Correct 80 ms 6512 KB Output is correct
3 Correct 77 ms 6608 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 35 ms 6636 KB Output is correct
6 Correct 164 ms 20804 KB Output is correct
7 Correct 61 ms 6608 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 148 ms 12748 KB Output is correct
2 Correct 19 ms 2008 KB Output is correct
3 Correct 6 ms 984 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 3 ms 984 KB Output is correct
6 Correct 137 ms 12796 KB Output is correct
7 Correct 10 ms 1492 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 16 ms 1880 KB Output is correct
2 Correct 49 ms 5452 KB Output is correct
3 Correct 5 ms 984 KB Output is correct
4 Correct 5 ms 856 KB Output is correct
5 Correct 37 ms 6600 KB Output is correct
6 Correct 14 ms 2008 KB Output is correct
7 Correct 190 ms 20848 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 199 ms 20752 KB Output is correct
2 Correct 17 ms 2008 KB Output is correct
3 Correct 6 ms 856 KB Output is correct
4 Correct 216 ms 20896 KB Output is correct
5 Correct 49 ms 10568 KB Output is correct
6 Correct 10 ms 1492 KB Output is correct
7 Correct 20 ms 2896 KB Output is correct