bzoj2460,戳我戳我 Solution: 线性基板子,没啥好说的,注意long long 就好了 Code: //It is coded by Ning_Mew on 5.29 #include<bits/stdc++.h> #define LL long long using namespace std; const int maxn=1007; int n; LL A[maxn]; struct Node{ LL num;int val; }s[maxn]; LL ans=0; bo…
显然线性基可以满足题目中给出的条件.关键是如何使得魔力最大. 贪心策略是按魔力排序,将编号依次加入线性基,一个数如果和之前的一些数异或和为0就跳过他. 因为如果要把这个数放进去,那就要把之前的某个数拿出来,而这样交换之后集合能异或出的数是不会变的,和却变小了. # include <cstdio> # include <cstring> # include <cstdlib> # include <iostream> # include <vector…