Submission #109352

# Submission time Handle Problem Language Result Execution time Memory
109352 2019-05-06T08:51:08 Z dupreez Ice Hockey World Championship (CEOI15_bobek) C++14
100 / 100
488 ms 16888 KB
#include <iostream>
#include <algorithm>
#include <cstring>
#include <sstream>
#include <map>
#include <queue>
#include <vector>
#include <deque>
#include <climits>
#define scanf scanf_s
#define mk make_pair
#define pb push_back
using namespace std;
typedef long long int ll;
typedef pair<ll, ll> pos;
const ll MOD = 1000000007, N = 2010.;
ll n, m,l1[1<<20],l2[1<<20],a1[20],a2[20],n1,n2,ans;

int main() {
	cin >> n >> m;
	n1 = n / 2;
	n2 = n - n1;
	for (int i = 0; i < n1; i++)cin >> a1[i];
	for (int i = 0; i < n2; i++)cin >> a2[i];
	for (int s = 0; s < (1 << n1); s++) {
		for (int i = 0; i < n1; i++) { l1[s] += a1[i] * ((s >> i) & 1); }
	}
	for (int s = 0; s < (1 << n2); s++) {
		for (int i = 0; i < n2; i++) { l2[s] += a2[i] * ((s >> i) & 1); }
	}
	sort(l2, l2 + (1 << n2));
	for (int i = 0; i < (1 << n1); i++) {
		ll v1 = m - l1[i];
		ans += upper_bound(l2, l2 + (1 << n2), v1) - l2;
	}
	cout << ans << endl;
	return 0;
}

# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 3 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 384 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 3 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 384 KB Output is correct
3 Correct 3 ms 384 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 2 ms 384 KB Output is correct
6 Correct 2 ms 384 KB Output is correct
7 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 1920 KB Output is correct
2 Correct 99 ms 4476 KB Output is correct
3 Correct 488 ms 16804 KB Output is correct
4 Correct 83 ms 4480 KB Output is correct
5 Correct 10 ms 1408 KB Output is correct
6 Correct 9 ms 896 KB Output is correct
7 Correct 10 ms 1408 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 39 ms 2432 KB Output is correct
2 Correct 29 ms 1920 KB Output is correct
3 Correct 193 ms 8668 KB Output is correct
4 Correct 3 ms 384 KB Output is correct
5 Correct 14 ms 868 KB Output is correct
6 Correct 13 ms 1408 KB Output is correct
7 Correct 13 ms 1408 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 62 ms 3448 KB Output is correct
2 Correct 145 ms 6520 KB Output is correct
3 Correct 126 ms 6500 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 59 ms 6520 KB Output is correct
6 Correct 177 ms 16760 KB Output is correct
7 Correct 67 ms 6520 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 316 ms 12680 KB Output is correct
2 Correct 25 ms 1920 KB Output is correct
3 Correct 10 ms 896 KB Output is correct
4 Correct 2 ms 384 KB Output is correct
5 Correct 6 ms 896 KB Output is correct
6 Correct 164 ms 12664 KB Output is correct
7 Correct 10 ms 1408 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 28 ms 1920 KB Output is correct
2 Correct 86 ms 4520 KB Output is correct
3 Correct 9 ms 896 KB Output is correct
4 Correct 8 ms 896 KB Output is correct
5 Correct 64 ms 6648 KB Output is correct
6 Correct 22 ms 1912 KB Output is correct
7 Correct 191 ms 16760 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 350 ms 16888 KB Output is correct
2 Correct 32 ms 1920 KB Output is correct
3 Correct 10 ms 768 KB Output is correct
4 Correct 438 ms 16784 KB Output is correct
5 Correct 80 ms 8568 KB Output is correct
6 Correct 11 ms 1408 KB Output is correct
7 Correct 20 ms 2432 KB Output is correct