1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| struct Linnerbasis { std::array<i64, 64> base{0}; bool insert(i64 x) { for (int i = 63; i >= 0; i--) if ((1ll << i) & x) { if (base[i]) x ^= base[i]; else { base[i] = x; return true; } } return false; } void normaize() { for (int i = 62; i >= 0; i--) for (int j = i + 1; j < 64; j++) if ((base[i] ^ base[j]) < base[j]) base[j] = base[i] ^ base[j]; } };
|