#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);
dp[a[0]] = 1;
dp[0] = 1;
for (int i = 1; i < n; i++)
for (int j = m; j >= 0; j--)
if (j-a[i] >= 0)
dp[j] += dp[j-a[i]];
int cnt = 0;
for (int i = 0; i <= m; i++)
cnt+=dp[i];
cout << cnt << '\n';
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
6492 KB |
Output is correct |
2 |
Correct |
4 ms |
3932 KB |
Output is correct |
3 |
Correct |
5 ms |
3676 KB |
Output is correct |
4 |
Correct |
6 ms |
5980 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
7 ms |
6488 KB |
Output is correct |
7 |
Runtime error |
5 ms |
10076 KB |
Execution killed with signal 11 |
8 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
23 ms |
4956 KB |
Output is correct |
3 |
Correct |
25 ms |
7516 KB |
Output is correct |
4 |
Correct |
15 ms |
4956 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
5 ms |
1784 KB |
Output is correct |
7 |
Runtime error |
4 ms |
8284 KB |
Execution killed with signal 11 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
604 KB |
Output is correct |
2 |
Correct |
6 ms |
2388 KB |
Output is correct |
3 |
Correct |
1 ms |
408 KB |
Output is correct |
4 |
Correct |
2 ms |
3416 KB |
Output is correct |
5 |
Correct |
0 ms |
344 KB |
Output is correct |
6 |
Correct |
19 ms |
7004 KB |
Output is correct |
7 |
Runtime error |
1 ms |
604 KB |
Execution killed with signal 11 |
8 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
4440 KB |
Output is correct |
2 |
Correct |
8 ms |
2652 KB |
Output is correct |
3 |
Correct |
7 ms |
2604 KB |
Output is correct |
4 |
Correct |
1 ms |
892 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
16 ms |
4188 KB |
Output is correct |
7 |
Runtime error |
5 ms |
7964 KB |
Execution killed with signal 11 |
8 |
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 |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
2 ms |
600 KB |
Execution killed with signal 6 |
2 |
Halted |
0 ms |
0 KB |
- |