Submission #1005006

# Submission time Handle Problem Language Result Execution time Memory
1005006 2024-06-22T06:06:17 Z erering Ice Hockey World Championship (CEOI15_bobek) C++17
50 / 100
444 ms 1048576 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;
void func(int i,int score){
    if(i==n){
        ans++;
        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];
    if(n<=20)func(0,0);
    else{
        int dp[n][m+1];
        for(int j=0;j<=m;j++)dp[0][j]=0;
        dp[0][0]=1; dp[0][a[0]]=1;
        for(int i=1;i<n;i++){
            for(int j=0;j<=m;j++){
                if(j>a[i] && dp[i-1][j-a[i]]>0)dp[i][j]=dp[i-1][j-a[i]]+dp[i-1][j];
                else dp[i][j]=dp[i-1][j];
                if(j==a[i])dp[i][j]++;
            }
        }
        for(int j=0;j<=m;j++){
            ans+=dp[n-1][j];
        }
    }
    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 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 420 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 2 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 1 ms 348 KB Output is correct
7 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 4 ms 5212 KB Output is correct
2 Correct 105 ms 170140 KB Output is correct
3 Correct 182 ms 285780 KB Output is correct
4 Correct 104 ms 164176 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 26 ms 40796 KB Output is correct
7 Runtime error 149 ms 254424 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 6 ms 9820 KB Output is correct
2 Correct 44 ms 64332 KB Output is correct
3 Correct 3 ms 4184 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 134 ms 218260 KB Output is correct
7 Correct 3 ms 4440 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 95 ms 143960 KB Output is correct
2 Correct 54 ms 84648 KB Output is correct
3 Correct 54 ms 80212 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 93 ms 151604 KB Output is correct
7 Runtime error 179 ms 275508 KB Execution killed with signal 11
8 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 444 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 436 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 419 ms 1048576 KB Execution killed with signal 9
2 Halted 0 ms 0 KB -