CF1166E The LCMs Must be Large
CF1166E The LCMs Must be Large
构造趣题
正着推其实很不好推
不妨大力猜结论
如果两两集合都有交,那么一定可以
证明:
1.显然如果两个集合没有交,一定不可以
2.否则给每个集合Si乘上一个质数pi,pi互不相同
由于两两有交,那么一个集合Si的LCM一定是所有p的乘积,而其补集一定没有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=;bool fl=false;while(!isdigit(ch=getchar()))(ch=='-')&&(fl=true);
for(x=numb;isdigit(ch=getchar());x=x*+numb);(fl==true)&&(x=-x);}
template<class T>il void output(T x){if(x/)output(x/);putchar(x%+'');}
template<class T>il void ot(T x){if(x<) 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=;
int ad(int x,int y){return (x+y)>=mod?x+y-mod:x+y;}
void inc(int &x,int y){x=ad(x,y);}
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-){int ret=;while(y){if(y&) ret=mul(x,ret);x=mul(x,x);y>>=;}return ret;}
}
//using namespace Modulo;
namespace Miracle{
const int M=;
const int N=1e4+;
bitset<N>s[M],lp;
int main(){
int n,m;rd(m);rd(n);
for(reg i=;i<=m;++i){
int k;rd(k);
for(reg j=;j<=k;++j) {
int x;rd(x);s[i][x]=;
}
for(reg j=;j<i;++j){
lp=s[i]&s[j];
if(lp.count()==) goto nd;
}
} puts("possible");
return ;
nd:;
puts("impossible");
return ;
} }
signed main(){
Miracle::main();
return ;
} /*
Author: *Miracle*
*/
CF1166E The LCMs Must be Large的更多相关文章
- CodeForces 1166E The LCMs Must be Large
题目链接:http://codeforces.com/problemset/problem/1166/E 说明 LCM(一个集合) 为这个集合中所有元素的最小公倍数. 如果$A \subseteq B ...
- Codeforces Round #561 (Div. 2) E. The LCMs Must be Large(数学)
传送门 题意: 有 n 个商店,第 i 个商店出售正整数 ai: Dora 买了 m 天的东西,第 i 天去了 si 个不同的个商店购买了 si 个数: Dora 的对手 Swiper 在第 i 天去 ...
- 降智严重——nowcoder练习赛46&&codeforces #561 Div2
两场比赛降智不停,熬夜爆肝更掉rating nowcoder: https://ac.nowcoder.com/acm/contest/894#question T1:水题 T2:考虑a和b的子区间! ...
- Quantitative proteomic analysis of small and large extracellular vesicles (EVs) reveals enrichment of adhesion proteins in small EVs (文献分享一组-柯酩)
文献名:Quantitative proteomic analysis of small and large extracellular vesicles (EVs) reveals enrichme ...
- 基于Caffe的Large Margin Softmax Loss的实现(中)
小喵的唠叨话:前一篇博客,我们做完了L-Softmax的准备工作.而这一章,我们开始进行前馈的研究. 小喵博客: http://miaoerduo.com 博客原文: http://www.miao ...
- 基于Caffe的Large Margin Softmax Loss的实现(上)
小喵的唠叨话:在写完上一次的博客之后,已经过去了2个月的时间,小喵在此期间,做了大量的实验工作,最终在使用的DeepID2的方法之后,取得了很不错的结果.这次呢,主要讲述一个比较新的论文中的方法,L- ...
- mysql Packet for query is too large (1185 > 1024)异常
注:最近mysql一直提示如下错误 Packet for query is too large (1185 > 1024). You can change this value on the s ...
- C#+无unsafe的非托管大数组(large unmanaged array in c# without 'unsafe' keyword)
C#+无unsafe的非托管大数组(large unmanaged array in c# without 'unsafe' keyword) +BIT祝威+悄悄在此留下版了个权的信息说: C#申请一 ...
- ORA-12899: value too large for column (actual: 27, maximum: 20)
导入数据时报错以下错误,这是因为原来的数据库是GBK的,每个汉字两个字节,但新数据库是UTF-8的,每个汉字是三个字节,导致超过长度了. ORA-12899: value too large for ...
随机推荐
- SDUT-3398_数据结构实验之排序一:一趟快排
数据结构实验之排序一:一趟快排 Time Limit: 1000 ms Memory Limit: 65536 KiB Problem Description 给定N个长整型范围内的整数,要求输出以给 ...
- solr dataimport中遇到的问题
1.windows的tomcat是没有catalina.out的,可以通过修改start.bat和catalina.bat的方式让日志输出到catalina.out 2.按照网上搜到的资料配置好sol ...
- Spring 配置标签——util标签
Spring 配置标签——util标签 一.配置applicationContext.xml <beans xmlns="http://www.springframework. ...
- python os 模块介绍
""" 重命名文件 os.rename(src,dst) os.rename('123.txt','124.txt') 删除文件 os.remove(path) os.r ...
- day39 10-Spring的AOP:基于AspectJ的切点定义
切点是我们真正应用在哪些方法上,增强的那些方法上,就是add().update()和find().delete()是没用的.没用的话就是这三个方法.为什么要定义一个切点呢? 所以可以直接在切面中定义一 ...
- mongodb的一些简单操作
mongo 使用 mongod 开机mongod --dbpath c:\mongo mongod --storageEngine mmapv1 --dbpath c:\mongo mongoimpo ...
- pl/sql基础知识—过程快速入门
n 过程 过程用于执行特定的操作,当建立过程时,既可以指定输入参数(in),也可以指定输出参数(out),通过在过程中使用输入参数,可以将数据传递到执行部分:通过使用输出参数可以将执行部分的数据传递 ...
- webpack配置vue项目
npm init 安装webpack,webpack-cli 新建src目录,在src目录下新建main.js
- Codeforces 336C
这题是大一暑假时候做的,当时没有出,直到今天突然觉得应该把没过的题目再做一边,不然真的是越积越多. 现在能够独立做出来真的是难以表达的兴奋,刚开始的时候就觉得 O(30 * 30 * n)的复杂度有点 ...
- sql —— check
CHECK 约束用于限制列中的值的范围. 原表: 现在要对性别这一列进行约束,只准值为男或者女. 步骤: 1. 2. 3. 4. 5. ctrl + s 保存一下, 现在不可以随意的修改性别了. 完成 ...