Submission #870271

# Submission time Handle Problem Language Result Execution time Memory
870271 2023-11-07T11:32:54 Z vjudge1 Ice Hockey World Championship (CEOI15_bobek) C++17
70 / 100
66 ms 7580 KB
#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];
	if (m <= 1000000)
	{
	vector <int> dp(m+1,0);
	dp[0] = 1;
	for (int i = 0; i < n; i++)
		for (int j = m; j >= a[i]; j--)				
			dp[j] += dp[j-a[i]];
	int cnt = 0;
	for (int i = 0; i <= m; i++)
		cnt+=dp[i];
	cout << cnt << '\n';	
}
else

{
	int cnt = 0;
		for (int i = 0; i < (1<<n); i++)
		{
			int sum = 0;
			for (int j = 0; j < n; j++)
				if ((1<<j)&i)
					sum+=a[j];
			if (sum <= m)
				cnt++;
		}
		cout << cnt << '\n';
}

}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 9 ms 6748 KB Output is correct
2 Correct 3 ms 3932 KB Output is correct
3 Correct 2 ms 3672 KB Output is correct
4 Correct 5 ms 5976 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 7 ms 6492 KB Output is correct
7 Correct 2 ms 4956 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 7 ms 600 KB Output is correct
2 Correct 4 ms 348 KB Output is correct
3 Correct 7 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 66 ms 348 KB Output is correct
7 Correct 8 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 60 ms 408 KB Output is correct
2 Correct 17 ms 344 KB Output is correct
3 Correct 4 ms 348 KB Output is correct
4 Correct 4 ms 344 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 8 ms 348 KB Output is correct
7 Correct 8 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 604 KB Output is correct
2 Correct 15 ms 4956 KB Output is correct
3 Correct 24 ms 7580 KB Output is correct
4 Correct 18 ms 5212 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 5 ms 1628 KB Output is correct
7 Correct 2 ms 4216 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 604 KB Output is correct
2 Correct 6 ms 2140 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 2 ms 3420 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 19 ms 7260 KB Output is correct
7 Correct 1 ms 548 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 15 ms 4548 KB Output is correct
2 Correct 7 ms 2908 KB Output is correct
3 Correct 7 ms 2396 KB Output is correct
4 Correct 1 ms 860 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 14 ms 4228 KB Output is correct
7 Correct 1 ms 3932 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -