# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
461151 | vanic | Ice Hockey World Championship (CEOI15_bobek) | C++14 | 1087 ms | 296 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 <iostream>
#include <cstdio>
#include <cmath>
#include <algorithm>
#include <vector>
using namespace std;
typedef long long ll;
const int maxn=45;
ll a[maxn];
ll pref[maxn];
ll sol;
void rijesi(int x, ll sum){
if(sum<0){
return;
}
if(sum>=pref[x+1]){
sol+=(1ll<<(x+1));
return;
}
sol++;
for(int i=x; i>-1; i--){
rijesi(i-1, sum-a[i]);
}
}
int main(){
int n;
ll m;
scanf("%d%lld", &n, &m);
for(int i=0; i<n; i++){
scanf("%lld", a+i);
}
sort(a, a+n);
for(int i=0; i<n; i++){
pref[i+1]=pref[i]+a[i];
}
rijesi(n-1, m);
printf("%lld\n", sol);
return 0;
}
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... |