Submission #759208

# Submission time Handle Problem Language Result Execution time Memory
759208 2023-06-15T21:08:39 Z sofija6 Ice Hockey World Championship (CEOI15_bobek) C++14
50 / 100
1000 ms 156516 KB
#include <bits/stdc++.h>
#define ll long long
#define MAXN 50
using namespace std;
ll a[MAXN];
set<ll> s1,s2;
map<ll,ll> cnt1,cnt2;
void Solve(ll l,ll r,ll cur,ll pos,set<ll> &s,map<ll,ll> &cnt)
{
    if (pos>r)
    {
        s.insert(cur);
        cnt[cur]++;
        return;
    }
    Solve(l,r,cur,pos+1,s,cnt);
    Solve(l,r,cur+a[pos],pos+1,s,cnt);
}
int main()
{
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    ll n,m,ans=0;
    cin >> n >> m;
    for (ll i=1;i<=n;i++)
        cin >> a[i];
    Solve(1,n/2,0,1,s1,cnt1);
    Solve(n/2+1,n,0,n/2+1,s2,cnt2);
    ll cur=0;
    for (auto i : cnt2)
    {
        cur+=i.second;
        cnt2[i.first]=cur;
    }
    for (auto i : s1)
    {
        auto it=s2.lower_bound(m-i);
        if ((*it)!=m-i)
        {
            if (it==s2.begin())
                continue;
            it--;
        }
        ans+=cnt1[i]*cnt2[*it];
    }
    cout << ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 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 1 ms 324 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 212 KB Output is correct
6 Correct 1 ms 536 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 468 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 324 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Correct 1 ms 340 KB Output is correct
6 Correct 1 ms 340 KB Output is correct
7 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 38 ms 2876 KB Output is correct
2 Correct 386 ms 38208 KB Output is correct
3 Execution timed out 1078 ms 88716 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 60 ms 4916 KB Output is correct
2 Correct 98 ms 13856 KB Output is correct
3 Correct 155 ms 2396 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 2 ms 212 KB Output is correct
6 Correct 39 ms 5940 KB Output is correct
7 Correct 67 ms 14556 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 325 ms 31396 KB Output is correct
2 Correct 389 ms 32300 KB Output is correct
3 Correct 426 ms 30804 KB Output is correct
4 Correct 1 ms 340 KB Output is correct
5 Incorrect 18 ms 320 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1085 ms 156516 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 132 ms 21756 KB Output is correct
2 Correct 517 ms 57756 KB Output is correct
3 Correct 30 ms 7380 KB Output is correct
4 Correct 29 ms 7480 KB Output is correct
5 Correct 22 ms 340 KB Output is correct
6 Correct 137 ms 21844 KB Output is correct
7 Execution timed out 1041 ms 151308 KB Time limit exceeded
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 1066 ms 154992 KB Time limit exceeded
2 Halted 0 ms 0 KB -