CF 1174 D. Ehab and the Expected XOR Problem 异或技巧

题意就是给我们两个数n,x。让我们构造个数组,数组有三个条件

1.要有尽可能多的元素

2.要其中任何一段数字的异或和不等于0和x

3.元素的范围是[ 1, 2^n)


#include
#include
#include
#include
using namespace std;
const int maxn =1<<19;
int cnt,S[maxn];
int main()
{
    int n,x;
    scanf("%d%d",&n,&x);
    // 不能存在两相等 也不能存在和x异或为0的数
    sets;
    s.insert(0);
    for(int i=1;i<(1<

你可能感兴趣的:(算法)