General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
84041591 Practice:
JKLover
449D - 22 C++17 (GCC 7-32) Accepted 405 ms 12328 KB 2020-06-17 09:28:56 2020-06-17 09:48:51
→ Source
//%std
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
inline int read()
{
	int out = 0, fh = 1;
	char jp = getchar();
	while ((jp > '9' || jp < '0') && jp != '-')
		jp = getchar();
	if (jp == '-')
		fh = -1, jp = getchar();
	while (jp >= '0' && jp <= '9')
		out = out * 10 + jp - '0', jp = getchar();
	return out * fh;
}
void print(int x)
{
	if (x >= 10)
		print(x / 10);
	putchar('0' + x % 10);
}
void write(int x, char c)
{
	if (x < 0)
		putchar('-'), x = -x;
	print(x);
	putchar(c);
}
const int P = 1e9 + 7;
int add(int a, int b)
{
	return a + b >= P ? a + b - P : a + b;
}
void inc(int &a, int b)
{
	a = add(a, b);
}
int mul(int a, int b)
{
	return 1LL * a * b % P;
}
const int N = 1 << 20 | 10, k = 20;
int n, a[N], bin[N], popc[N];
int main()
{
	bin[0] = 1;
	n = read();
	for (int i = 1; i <= n; ++i)
	{
		a[read()]++;
		bin[i] = add(bin[i - 1], bin[i - 1]);
	}
	for (int i = 0; i < k; ++i)
		for (int S = 0; S < (1 << k); ++S)
			if (S >> i & 1)
				a[S ^ 1 << i] += a[S];
	int ans = 0;
	for (int S = 0; S < (1 << k); ++S)
	{
		popc[S] = popc[S >> 1] + (S & 1);
		int x = add(bin[a[S]], P - 1);
		if (popc[S] & 1)
			inc(ans, P - x);
		else
			inc(ans, x);
	}
	write(ans, '\n');
	return 0;
}
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details