传送门

题意:

  有 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. 多云混合云之多集群统一管理:基于阿里云ACK统一纳管多个不同Kubernetes集群

    目前阿里云云原生产品家族已经支持多集群管理功能,允许使用阿里云容器服务Kubernetes(简称ACK)控制台或kubectl命令接入.统一纳管其他公有云.客户IDC自建K8s集群,集中管理部署K8s ...

  2. Python之collection

    1.计数器(counter) Counter是对字典类型的补充,用于追踪值的出现次数. ps:具备字典的所有功能 + 自己的功能 c = Counter('abcdeabcdabcaba') prin ...

  3. laravel微信自定义分享

    https://blog.csdn.net/weixin_41530218/article/details/80777036 今天接触到了微信分享,来记录一下自己所理解的一些逻辑,首先,我画了一个草图 ...

  4. kubernetes1.5新特性跟踪(续)

    Kubernetes发布历史回顾 Kubernetes 1.0 - 2015年7月发布 Kubernetes 1.1 - 2015年11月发布 Kubernetes 1.2 - 2016年3月发布 K ...

  5. ELK背景介绍1

    一.elasticsearch背景介绍 1.问题引入:搜索所有天安门相关的内容,大数据量的判断,加索引orm,歌词怎么做?等等问题,大公司上亿条数据怎样开发处理日志? 2.ELK框架,目前先学习E(e ...

  6. python小练习--银行取款

    银行取款 今天练习的小程序: #!/usr/bin/env python #-*- coding:utf-8 -*- import time tag=True while tag: name=inpu ...

  7. Hdu 4291

    题目链接 这道题, 给我的最大的知识点就是对于去模运算,一定可以找到循环节,这题只不过是嵌套了两层,可以分别找到循环节.关于这题如何找循环节的,直接暴力,网上也有很多. 找到循环节之后,另一个知识点就 ...

  8. 小爬爬7:回顾&&crawlSpider

    1.回顾昨日内容 回顾 - 全站数据爬取(分页) - 手动请求的发送Request(url,callback) - post请求和cookie处理 - start_requests(self) - F ...

  9. 【7.18总结】KM算法

    先贴代码,参考博客来源于:https://blog.csdn.net/zyy173533832/article/details/11519291#commentBox 例题:HDU 2255 题意:n ...

  10. BZOJ 1500 洛谷2042维护序列题解

    BZ链接 洛谷链接 这道题真是丧心病狂.... 应该很容易就可以看出做法,但是写代码写的....... 思路很简单,用一个平衡树维护一下所有的操作就好了,重点讲解一下代码的细节 首先如果按照常规写法的 ...