Submission #606859

# Submission time Handle Problem Language Result Execution time Memory
606859 2022-07-26T09:18:13 Z Hanksburger Ice Hockey World Championship (CEOI15_bobek) C++17
100 / 100
424 ms 8660 KB
#include <bits/stdc++.h>
using namespace std;
long long a[45], n, m, ans;
vector<long long> v;
void f(int l, int r, long long s)
{
    if (l>r)
    {
        if (r==n/2)
            v.push_back(s);
        else
            ans+=upper_bound(v.begin(), v.end(), m-s)-v.begin();
        return;
    }
    f(l+1, r, s);
    f(l+1, r, s+a[l]);
}
int main()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin >> n >> m;
    for (int i=1; i<=n; i++)
        cin >> a[i];
    f(1, n/2, 0);
    sort(v.begin(), v.end());
    f(n/2+1, n, 0);
    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 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 324 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 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 324 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 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 212 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 23 ms 856 KB Output is correct
2 Correct 69 ms 2512 KB Output is correct
3 Correct 424 ms 8648 KB Output is correct
4 Correct 66 ms 2512 KB Output is correct
5 Correct 7 ms 964 KB Output is correct
6 Correct 4 ms 600 KB Output is correct
7 Correct 7 ms 856 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 27 ms 1476 KB Output is correct
2 Correct 19 ms 856 KB Output is correct
3 Correct 148 ms 4460 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 4 ms 600 KB Output is correct
6 Correct 9 ms 856 KB Output is correct
7 Correct 8 ms 856 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 47 ms 1492 KB Output is correct
2 Correct 109 ms 2512 KB Output is correct
3 Correct 129 ms 2512 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 36 ms 2512 KB Output is correct
6 Correct 124 ms 8648 KB Output is correct
7 Correct 37 ms 2524 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 249 ms 4556 KB Output is correct
2 Correct 23 ms 984 KB Output is correct
3 Correct 7 ms 600 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 3 ms 600 KB Output is correct
6 Correct 74 ms 4556 KB Output is correct
7 Correct 6 ms 964 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 20 ms 960 KB Output is correct
2 Correct 78 ms 2512 KB Output is correct
3 Correct 6 ms 600 KB Output is correct
4 Correct 7 ms 600 KB Output is correct
5 Correct 40 ms 2512 KB Output is correct
6 Correct 9 ms 984 KB Output is correct
7 Correct 131 ms 8648 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 265 ms 8660 KB Output is correct
2 Correct 21 ms 984 KB Output is correct
3 Correct 7 ms 600 KB Output is correct
4 Correct 341 ms 8648 KB Output is correct
5 Correct 47 ms 4556 KB Output is correct
6 Correct 7 ms 856 KB Output is correct
7 Correct 14 ms 1492 KB Output is correct