#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);
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
318 ms |
391844 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
317 ms |
391724 KB |
Output is correct |
2 |
Correct |
319 ms |
391780 KB |
Output is correct |
3 |
Correct |
319 ms |
391708 KB |
Output is correct |
4 |
Correct |
319 ms |
391720 KB |
Output is correct |
5 |
Correct |
319 ms |
391864 KB |
Output is correct |
6 |
Correct |
317 ms |
391672 KB |
Output is correct |
7 |
Correct |
373 ms |
391672 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
320 ms |
391772 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
320 ms |
391672 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
330 ms |
391852 KB |
Output is correct |
2 |
Correct |
762 ms |
391800 KB |
Output is correct |
3 |
Execution timed out |
1107 ms |
391800 KB |
Time limit exceeded |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
334 ms |
391672 KB |
Output is correct |
2 |
Correct |
446 ms |
391800 KB |
Output is correct |
3 |
Correct |
332 ms |
391800 KB |
Output is correct |
4 |
Correct |
320 ms |
391800 KB |
Output is correct |
5 |
Correct |
320 ms |
391852 KB |
Output is correct |
6 |
Correct |
351 ms |
391800 KB |
Output is correct |
7 |
Correct |
320 ms |
391772 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
661 ms |
391768 KB |
Output is correct |
2 |
Correct |
505 ms |
391764 KB |
Output is correct |
3 |
Correct |
476 ms |
391672 KB |
Output is correct |
4 |
Correct |
323 ms |
391800 KB |
Output is correct |
5 |
Correct |
376 ms |
391672 KB |
Output is correct |
6 |
Correct |
337 ms |
391748 KB |
Output is correct |
7 |
Correct |
330 ms |
391672 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
846 ms |
785916 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
849 ms |
792584 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
336 ms |
391760 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |