| # | Time | Username | Problem | Language | Result | Execution time | Memory | 
|---|---|---|---|---|---|---|---|
| 1028226 | vjudge1 | Ice Hockey World Championship (CEOI15_bobek) | C++14 | 55 ms | 10696 KiB | 
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
vector<int> df(vector<int> v) {
    int n = v.size();
    vector<int> res;
    for(int i = 0; i < (1 << n); i++) {
        int sum = 0;
        for(int j = 0; j < n; j++) {
            sum += ((i >> j) & 1) * v[j];
        }
        res.push_back(sum);
    }
    sort(res.begin(), res.end());
    return res;
}
void solve(){
    int n, m;
    cin >> n >> m;
    vector<int> a(n);
    for(int i = 0; i < n; i++) {
        cin >> a[i];
    }
    if(n == 1) {
        if(a[0] <= m) cout << "2" << endl;
        else cout << "1" << endl;
        return;
    }
    int a1 = n / 2;
    int b1 = n - a1;
    vector<int> h = a;
    h.resize(a1);
    vector<int> h2 = a;
    reverse(h2.begin(), h2.end());
    h2.resize(b1);
    reverse(h2.begin(), h2.end());
    vector<int> x = df(h);
    vector<int> y = df(h2);
    reverse(y.begin(), y.end());
    int ans = 0;
    int idx = 0;
    for(int cur : x) {
        while(idx < y.size() && cur + y[idx] > m) {
            idx++;
        }
        ans += y.size() - idx;
    }
    cout << ans << endl;
}
signed main() {
    solve();
}
Compilation message (stderr)
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output | 
|---|---|---|---|---|
| Fetching results... | ||||
