#include <bits/stdc++.h>
#define loop(i, a, b) for(int i=a;i<b;i++)
using namespace std;
typedef long long ll;
map<ll, ll> dp;
int main(){
ll n, m, t;cin>> n >> m;
dp[0]=1;
loop(agsdgs, 0, n){
cin >> t;
map<ll, ll> dp2=dp;
for(auto&& i:dp) if(i.first+t<=m) dp2[i.first+t]+=i.second;
dp=dp2;
}
ll ans=0;
for(auto&& i:dp) ans+=i.second;
cout << ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
376 KB |
Output is correct |
2 |
Correct |
1 ms |
248 KB |
Output is correct |
3 |
Correct |
2 ms |
256 KB |
Output is correct |
4 |
Correct |
2 ms |
376 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
3 ms |
424 KB |
Output is correct |
7 |
Correct |
2 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
38 ms |
9184 KB |
Output is correct |
2 |
Correct |
18 ms |
4088 KB |
Output is correct |
3 |
Correct |
34 ms |
8184 KB |
Output is correct |
4 |
Correct |
2 ms |
256 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
627 ms |
131784 KB |
Output is correct |
7 |
Correct |
2 ms |
256 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
472 ms |
96868 KB |
Output is correct |
2 |
Correct |
39 ms |
8440 KB |
Output is correct |
3 |
Correct |
26 ms |
6520 KB |
Output is correct |
4 |
Correct |
11 ms |
2296 KB |
Output is correct |
5 |
Correct |
2 ms |
376 KB |
Output is correct |
6 |
Correct |
69 ms |
16760 KB |
Output is correct |
7 |
Correct |
2 ms |
376 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
65 ms |
2552 KB |
Output is correct |
2 |
Execution timed out |
1085 ms |
63472 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
119 ms |
4728 KB |
Output is correct |
2 |
Execution timed out |
1058 ms |
28704 KB |
Time limit exceeded |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1086 ms |
56080 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1078 ms |
262640 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1099 ms |
261560 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Execution timed out |
1102 ms |
263204 KB |
Time limit exceeded |
2 |
Halted |
0 ms |
0 KB |
- |