#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";
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
29 ms |
69312 KB |
Output is correct |
2 |
Correct |
15 ms |
41320 KB |
Output is correct |
3 |
Correct |
11 ms |
30300 KB |
Output is correct |
4 |
Correct |
20 ms |
62296 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
31 ms |
75464 KB |
Output is correct |
7 |
Correct |
20 ms |
52060 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
604 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
600 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
4 ms |
5724 KB |
Output is correct |
2 |
Correct |
70 ms |
179800 KB |
Output is correct |
3 |
Correct |
115 ms |
300064 KB |
Output is correct |
4 |
Correct |
72 ms |
173392 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
19 ms |
43400 KB |
Output is correct |
7 |
Correct |
50 ms |
133508 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
5 ms |
10332 KB |
Output is correct |
2 |
Correct |
31 ms |
68376 KB |
Output is correct |
3 |
Correct |
2 ms |
4444 KB |
Output is correct |
4 |
Correct |
10 ms |
22196 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
73 ms |
231764 KB |
Output is correct |
7 |
Correct |
3 ms |
4696 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
52 ms |
152204 KB |
Output is correct |
2 |
Correct |
39 ms |
89168 KB |
Output is correct |
3 |
Correct |
37 ms |
84656 KB |
Output is correct |
4 |
Correct |
6 ms |
11972 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
55 ms |
159316 KB |
Output is correct |
7 |
Correct |
49 ms |
143192 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
600 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
604 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
604 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |