Submission #1005033

# Submission time Handle Problem Language Result Execution time Memory
1005033 2024-06-22T06:24:53 Z erering Ice Hockey World Championship (CEOI15_bobek) C++17
40 / 100
270 ms 11984 KB
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pb push_back
#define ll long long
#define int long long
const long long inf=1e18;
const int MOD=1e9+7;
const int N=41;
int a[N],n,m,ans=0,dp[40][1000001];
bool flag=0;
vector<int> v;
void func(int i,int score){
    if(flag && i==n/2){
        auto it=upper_bound(v.begin(),v.end(),m-score)-v.begin();
        ans+=it;
        return;
    }
    if(i==n){
       v.pb(score);
        return;
    }
    func(i+1,score);
    if(score+a[i]<=m)func(i+1,score+a[i]);
}
signed main()
{
   ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    cin>>n>>m;
    for(int i=0;i<n;i++)cin>>a[i];
    dp[0][0]=1; dp[0][a[0]]=1;
    func(n/2,0);
    flag=1;
    sort(v.begin(),v.end());
    func(0,0);
    cout<<ans;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 2396 KB Output is correct
2 Correct 0 ms 2392 KB Output is correct
3 Correct 0 ms 2396 KB Output is correct
4 Correct 0 ms 2396 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Runtime error 4 ms 524 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 15 ms 1496 KB Output is correct
2 Correct 56 ms 4568 KB Output is correct
3 Correct 270 ms 11984 KB Output is correct
4 Correct 52 ms 2520 KB Output is correct
5 Correct 4 ms 992 KB Output is correct
6 Correct 3 ms 736 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 22 ms 1500 KB Output is correct
2 Correct 16 ms 1500 KB Output is correct
3 Correct 115 ms 6100 KB Output is correct
4 Correct 0 ms 2392 KB Output is correct
5 Correct 2 ms 860 KB Output is correct
6 Correct 6 ms 992 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 37 ms 2520 KB Output is correct
2 Correct 72 ms 5328 KB Output is correct
3 Correct 81 ms 5844 KB Output is correct
4 Correct 1 ms 344 KB Output is correct
5 Correct 25 ms 5844 KB Output is correct
6 Correct 91 ms 9424 KB Output is correct
7 Correct 0 ms 2396 KB Output is correct
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 604 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 520 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 4 ms 348 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -