设 $S$ 的 AND 和 $T$ 的 OR 的结果都等于 $x$,$\mathrm{popcount}(x)=k$。显然所有 $\mathrm{popcount}(v)$ 小于 $k$ 的数只能属于 $S$,大于 $k$ 的数只能属于 $T$,等于 $k$ 的数只能是 $x$。算一下是否满足条件即可。时间复杂度 $O(n\log n+(n+q)\log C)$。
QOJ.ac
QOJ
Discussion #311 for Problem #1650. AND = OR
Type: Editorial
Status: Open
Posted by: jiangly
Posted at: 2025-12-14 07:02:27
Last updated: 2025-12-14 07:02:29
题解
Comments
No comments yet.