Submission #968440

# Submission time Handle Problem Language Result Execution time Memory
968440 2024-04-23T12:28:42 Z vjudge1 Ice Hockey World Championship (CEOI15_bobek) C++17
0 / 100
174 ms 31724 KB
#include <bits/stdc++.h>
using namespace std;
#define ll long long
ll n,m;
ll pr[41];
vector<int> a={0},b={0};
void solvea(ll curr,ll pos,ll end) {
    if (curr == m) {
        return;
    }
    for (int i=pos+1;i<end;i++) {
        if (curr+pr[i] <= m) {
            a.push_back(curr+pr[i]);
            solvea(curr+pr[i],i,end);
        } else {
            return;
        }
    }
    return;
}
void solveb(ll curr,ll pos,ll end) {
    if (curr == m) {
        return;
    }
    for (int i=pos+1;i<end;i++) {
        if (curr+pr[i] <= m) {
            b.push_back(curr+pr[i]);
            solveb(curr+pr[i],i,end);
        } else {
            return;
        }
    }
    return;
}
int main() {
    cin.tie(0)->sync_with_stdio(false);
    cin >> n >> m;
    for (int i=0;i<n;i++) {
        cin >> pr[i];
        if (pr[i] > m) {
            i--;
            n--;
        }
    }
    sort(pr,pr+n);
    solvea(0,-1,n/2);
    solveb(0,n/2-1,n);
    for (auto i : a) {
        cout << i << ' ';
    }
    cout <<'\n';
    for (auto i : b) {
        cout << i << ' ';
    }
    cout <<'\n';
    ll cnt=0;
    n = a.size();
    for (int i=0;i<n;i++) {
        cnt+=upper_bound(b.begin(),b.end(),m-a[i])-b.begin();
    }
    cout << cnt;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 13 ms 2344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 19 ms 2912 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 25 ms 4440 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 132 ms 23220 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 3412 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 174 ms 31724 KB Output isn't correct
2 Halted 0 ms 0 KB -