Submission #870267

#TimeUsernameProblemLanguageResultExecution timeMemory
870267vjudge1Ice Hockey World Championship (CEOI15_bobek)C++17
50 / 100
20 ms7516 KiB
#include <bits/stdc++.h> #define int long long using namespace std; signed main() { int n,m; cin >> n >> m; vector <int> a(n); for (int i = 0; i < n; i++) cin >> a[i]; vector <int> dp(m+1,0); if (a[0] <= m) dp[a[0]] = 1; dp[0] = 1; for (int i = 1; i < n; i++) { if (a[i] > m) continue; for (int j = m; j >= a[i]; j--) dp[j] += dp[j-a[i]]; } int cnt = 0; for (int i = 0; i <= m; i++) cnt+=dp[i]; cout << cnt << '\n'; }
#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...