CF1166E The LCMs Must be Large

1.显然如果两个集合没有交，一定不可以

2.否则给每个集合Si乘上一个质数pi，pi互不相同

#include<bits/stdc++.h>
#define reg register int
#define il inline
#define fi first
#define se second
#define mk(a,b) make_pair(a,b)
#define numb (ch^'0')
#define pb push_back
#define solid const auto &
#define enter cout<<endl
#define pii pair<int,int>
using namespace std;
typedef long long ll;
template<class T>il void rd(T &x){
char ch;x=0;bool fl=false;while(!isdigit(ch=getchar()))(ch=='-')&&(fl=true);
for(x=numb;isdigit(ch=getchar());x=x*10+numb);(fl==true)&&(x=-x);}
template<class T>il void output(T x){if(x/10)output(x/10);putchar(x%10+'0');}
template<class T>il void ot(T x){if(x<0) putchar('-'),x=-x;output(x);putchar(' ');}
template<class T>il void prt(T a[],int st,int nd){for(reg i=st;i<=nd;++i) ot(a[i]);putchar('\n');}
namespace Modulo{
const int mod=998244353;
int mul(int x,int y){return (ll)x*y%mod;}
void inc2(int &x,int y){x=mul(x,y);}
int qm(int x,int y=mod-2){int ret=1;while(y){if(y&1) ret=mul(x,ret);x=mul(x,x);y>>=1;}return ret;}
}
//using namespace Modulo;
namespace Miracle{
const int M=55;
const int N=1e4+4;
bitset<N>s[M],lp;
int main(){
int n,m;rd(m);rd(n);
for(reg i=1;i<=m;++i){
int k;rd(k);
for(reg j=1;j<=k;++j) {
int x;rd(x);s[i][x]=1;
}
for(reg j=1;j<i;++j){
lp=s[i]&s[j];
if(lp.count()==0) goto nd;
}
}

puts("possible");
return 0;
nd:;
puts("impossible");
return 0;
}

}
signed main(){
Miracle::main();
return 0;
}

/*
Author: *Miracle*
*/

posted @ 2019-05-19 16:25  *Miracle*  阅读(309)  评论(0编辑  收藏  举报