线性基求交

void merge(Vector b) {
	Vector c = *this;
	Vector res;
	for (int i = 0; i <= 63; ++i) {
		if (b[i]) {
			ull v = b[i], s = 0;
			for (int j = 63; ~j; --j) {
				if (v >> j & 1) {
					if (p[j]) {
						v ^= p[j], s ^= c[j];
						if (v) continue;
						res[i] = s;
					}
					else {
						p[j] = v, c[j] = s;
					}
					break;
				}
			}
		}
	}
	return *this = res, void();
}
posted @ 2023-02-02 21:13  youwike  阅读(28)  评论(0编辑  收藏  举报