题目链接:https://vjudge.net/problem/POJ-2443 Set Operation Time Limit: 3000MS Memory Limit: 65536K Total Submissions: 3554 Accepted: 1477 Description You are given N sets, the i-th set (represent by S(i)) have C(i) element (Here "set" isn't enti…
先把两个矩阵全都mod3. S[i][j][k]表示第i(0/1)个矩阵的行/列的第k位是不是j(1/2). 然后如果某两个矩乘对应位上为1.1,乘出来是1: 1.2:2: 2.1:2: 2.2:1. 然后分这四种情况把bitset and 起来,然后用count()数一下个数,计算下对答案矩阵该位置的贡献即可. #include<cstdio> #include<bitset> using namespace std; #define N 801 int n,x; bitset&…
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…
传送门 题意:给出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…