传送门

题意:

  有 n 个商店,第 i 个商店出售正整数 ai

  Dora 买了 m 天的东西,第 i 天去了 si 个不同的个商店购买了 si 个数;

  Dora 的对手 Swiper 在第 i 天去了 Dora 未去的商店购买了 n-si 个数;

  问在这m天里,是否存在序列a,使得这 m 天都满足 LCM(Dora购买的数) > LCM(Swiper购买的数);

题解:

  参考自(

  ①如果存在两天,在这两天中得到的数字集合不存在交集,那么肯定是无解的。
  ②如果任意两天之间都存在交集时,一定有解(还是不太理解)。

AC代码:

 #include<bits/stdc++.h>
using namespace std;
const int maxn=1e4+; int n,m;
bitset<maxn>b;
vector<bitset<maxn> >vs; char *Solve()
{
for(int i=;i < vs.size();++i)
for(int j=;j < vs.size();++j)
if(!(vs[i]&vs[j]).any())
return "impossible";
return "possible";
}
int main()
{
scanf("%d%d",&m,&n);
for(int i=;i <= m;++i)
{
int tot,s;
scanf("%d",&tot);
b.reset();
for(int j=;j <= tot;++j)
{
scanf("%d",&s);
b.set(s);
}
vs.push_back(b);
}
puts(Solve()); return ;
}

此处代码用到了一个STL中的一个骚操作bitset<>,详解戳这里

这个操作是我在看大神代码中看到的,tql;

STL也太强大了叭qwq!

  

Codeforces Round #561 (Div. 2) E. The LCMs Must be Large(数学)的更多相关文章

  1. Codeforces Round #561 (Div. 2) C. A Tale of Two Lands

    链接:https://codeforces.com/contest/1166/problem/C 题意: The legend of the foundation of Vectorland talk ...

  2. Codeforces Round #561 (Div. 2) B. All the Vowels Please

    链接:https://codeforces.com/contest/1166/problem/B 题意: Tom loves vowels, and he likes long words with ...

  3. Codeforces Round #561 (Div. 2) A. Silent Classroom

    链接:https://codeforces.com/contest/1166/problem/A 题意: There are nn students in the first grade of Nlo ...

  4. Codeforces Round 561(Div 2)题解

    这是一场失败的比赛. 前三题应该是随便搞的. D有点想法,一直死磕D,一直WA.(赛后发现少减了个1……) 看E那么多人过了,猜了个结论交了真过了. 感觉这次升的不光彩……还是等GR3掉了洗掉这次把, ...

  5. Codeforces Round #561 (Div. 2)

    C. A Tale of Two Lands 题意: 给出 n 个数,问有多少点对(x,y)满足 |x-y| ≤ |x|,|y| ≤ |x+y|: (x,y) 和 (y,x) 表示一种答案: 题解: ...

  6. Codeforces Round #561 (Div. 2) A. Silent Classroom(贪心)

    A. Silent Classroom time limit per test1 second memory limit per test256 megabytes inputstandard inp ...

  7. Codeforces Round #561 (Div. 2) A Tale of Two Lands 【二分】

    A Tale of Two Lands 题目链接(点击) The legend of the foundation of Vectorland talks of two integers xx and ...

  8. Codeforces Codeforces Round #319 (Div. 2) C. Vasya and Petya's Game 数学

    C. Vasya and Petya's Game Time Limit: 1 Sec Memory Limit: 256 MB 题目连接 http://codeforces.com/contest/ ...

  9. Codeforces Round #257 (Div. 1)449A - Jzzhu and Chocolate(贪婪、数学)

    主题链接:http://codeforces.com/problemset/problem/449/A ------------------------------------------------ ...

随机推荐

  1. TypeScript类型检查机制

    类型推断 指不需要指定变量的类型,TS编译器可以根据某些规则自动推断出类型. 什么时候会有类型推断? 声明变量时没有指定类型 函数默认参数 函数返回值 ...... let a; // 这时自动推断为 ...

  2. Vue动态加载异步组件

    背景: 目前我们项目都是按组件划分的,然后各个组件之间封装成产品.目前都是采用iframe直接嵌套页面.项目中我们还是会碰到一些通用的组件跟业务之间有通信,这种情况下iframe并不是最好的选择,if ...

  3. 怎么使用mysqlreplicate快速搭建MySQL主从呢?

    用其中的mysqlreplicate工具来快速搭建MySQL主从环境. HE1:192.168.1.248 slave HE3:192.168.1.250 master 实战 Part1:安装mysq ...

  4. 【JZOJ4928】【NOIP2017提高组模拟12.18】A

    题目描述 数据范围 对于100%的数据,n<=100000,1<=A[i]<=5000 =w= Ans=∏1ai 代码 #include<iostream> #inclu ...

  5. sql标签和include标签的使用

    <sql>用来封装SQL语句, <include>用来调用<sql>封装的语句 代码片段: <sql id="select"> SE ...

  6. [idea]idea配置tomcat 标签: tomcatidea 2017-03-12 22:12 402人阅读 评论(19)

    我们在使用idea的时候,一定会遇到的一步,就是使用tomcat来发布我们的项目,那么,如何在idea中设置tomcat呢?下面就随小编来一起学习一下吧. 设置tomcat 打开设置界面 Run-&g ...

  7. docker在windows下的安装

    Docker for Windows会默认包含两个引擎containers(linux和windows) 1. 下载Docker for Windows,https://docs.docker.com ...

  8. 每天一个linux命令(2): nl命令

    0.学习时间 2014-05-16 1.命令格式 nl [参数] 文件名 (文件名也缺省的情况下, 从标准输入中读入) 2.命令参数 -b t 空行不加行号(默认) -b a  空行也加行号(类似于c ...

  9. python系列之(5)PyMySQL的使用

    简介 PyMySQL是在 Python3.x 版本中用于连接 MySQL 服务器的一个库,Python2中是使用mysqldb. 安装 pip3 install pymysql 创建连接 #!/usr ...

  10. Run As none applicable

    详解如何在myeclipse中运行JSP,Run As none applicable(图) 内容提要:对JSP的访问都是用浏览器进行的,没有Run on Server这个选项.   在MyEclip ...