线性基 高斯消元法 C++
线性基是一种数据结构,用于高效地解决一类与线性无关性有关的问题。具体而言,线性基可以用于快速求解一组非负整数线性组合的最大值、最小值,或者进行异或运算的一些操作。
线性基的基本思想是使用一个长度固定的二进制向量表示一组数的线性组合关系。通过不断向线性基中插入新的数,可以将这组数的线性组合关系表示为线性基中的若干个线性无关的向量的异或和。
#include <bits/stdc++.h>
#define ll long long
#define int long long
#define endl "\n"
#define KUI ios::sync_with_stdio(0), cin.tie(0), cout.tie(0)
using namespace std;
const int con = 2e5 + 4;
const int N = 2e5;
const int mod = 998244353;
int n, m, k, a[60];
void gauss()
{for (int i = 62; i >= 0; i--){for (int j = k; j <= n; j++){if (a[j] >> i & 1){swap(a[k], a[j]);break;}}if ((a[k] >> i & 1) == 0){continue;}for (int j = 1; j <= n; j++){if (j != k &a