Submission #124276

#TimeUsernameProblemLanguageResultExecution timeMemory
124276elabensaadIce Hockey World Championship (CEOI15_bobek)C++14
40 / 100
1107 ms792584 KiB
#include <bits/stdc++.h> using namespace std; long long n, m, t[100], dp[1000005][50]; long long solve(int cur, int id){ if(cur < 0)return 0; if(id == n)return 1; if(dp[cur][id] != -1)return dp[cur][id]; return dp[cur][id] = solve(cur-t[id], id+1)+solve(cur, id+1); } int main (){ ios_base::sync_with_stdio(0); cin.tie(0); memset(dp, -1, sizeof(dp)); cin >> n >> m; for(int i = 0;i < n;i++){ cin >> t[i]; } cout << solve(m, 0); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...