#include <iostream>
#include <vector>
#define int long long
using namespace std;
signed main() {
int n, m, res = 0;
cin >> n >> m;
vector<int> a(n);
vector<vector<int>> dp(n+1, vector<int>(m+1));
for(int i = 0; i < n; i++) cin >> a[i];
dp[0][0] = 1;
for(int i = 1; i <= n; i++) {
for(int j = 0; j <= m; j++) {
dp[i][j] = dp[i-1][j]+(j>=a[i-1] ? dp[i-1][j-a[i-1]] : 0);
//cout << dp[i][j] << " ";
}
//cout << "\n";
}
for(int i = 0; i <= m; i++) res+=dp[n][i];
cout << res << "\n";
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
27 ms |
69276 KB |
Output is correct |
2 |
Correct |
14 ms |
41304 KB |
Output is correct |
3 |
Correct |
12 ms |
30296 KB |
Output is correct |
4 |
Correct |
25 ms |
62044 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
25 ms |
75580 KB |
Output is correct |
7 |
Correct |
17 ms |
52060 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
604 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
3 ms |
604 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
5724 KB |
Output is correct |
2 |
Correct |
65 ms |
179624 KB |
Output is correct |
3 |
Correct |
98 ms |
300204 KB |
Output is correct |
4 |
Correct |
60 ms |
173392 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
20 ms |
43404 KB |
Output is correct |
7 |
Correct |
50 ms |
133484 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
10332 KB |
Output is correct |
2 |
Correct |
31 ms |
68440 KB |
Output is correct |
3 |
Correct |
2 ms |
4444 KB |
Output is correct |
4 |
Correct |
8 ms |
22164 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
79 ms |
231764 KB |
Output is correct |
7 |
Correct |
2 ms |
4696 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
53 ms |
152408 KB |
Output is correct |
2 |
Correct |
39 ms |
89176 KB |
Output is correct |
3 |
Correct |
35 ms |
84572 KB |
Output is correct |
4 |
Correct |
5 ms |
11868 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
54 ms |
159204 KB |
Output is correct |
7 |
Correct |
61 ms |
143188 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
604 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
604 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
2 ms |
604 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |