x ^= d[i]; // 消掉最高位 } returnfalse; // 插入失败(线性相关) }
// 查询最大异或和 ll queryMax() { ll res = 0; for (int i = LOG; i >= 0; i--) { res = max(res, res ^ d[i]); } return res; }
// 查询最小非零异或和 ll queryMin() { for (int i = 0; i <= LOG; i++) { if (d[i]) return d[i]; } return0; }
// 判断 x 是否能被表示出来 boolcanRepresent(longlong x) { for (int i = LOG; i >= 0; i--) { if (!(x >> i & 1)) continue; if (!d[i]) returnfalse; x ^= d[i]; } returntrue; } };