传送门 题意:给出n个集合(n<=1000),每个集合中最多有10000个数,每个数的范围为1~10000,给出q次询问(q<=200000),每次给出两个数u,v判断是否有一个集合中同时含有u,v两个数 枚举每一个集合,看看是否同时又u和v,显然超时 用bitset维护每一个数所在集合,求解的时候直接u & v即可 #include <cstdio> #include <bitset> using namespace std; int n, m; bitset…
[CF1097F]Alex and a TV Show(bitset) 题面 洛谷 CF 题解 首先模\(2\)意义下用\(bitset\)很明显了. 那么问题在于怎么处理那个\(gcd\)操作. 然后就莫比乌斯反演一下:\(f[n]=\sum\limits_{n|d}g[d],g[n]=\sum\limits_{n|d}\mu(\frac{d}{n})f[d]\),发现这样子搞完之后,如果要处理集合\(g\)的\(gcd\)操作,就是把\(g\)变成\(f\)之后再按位乘起来(二进制意义下的按…
You are given N sets, the i-th set (represent by S(i)) have C(i) element (Here "set" isn't entirely the same as the "set" defined in mathematics, and a set may contain two same element). Every element in a set is represented by a posit…