题意:有一条上面有n个点的数轴,给定m次操作,每次覆盖(x[i],y[i]),求最后没有被覆盖过的点的数量与他们的编号

n,m<=100

思路:

 #include<cstdio>
#include<cstring>
#include<string>
#include<cmath>
#include<iostream>
#include<algorithm>
#include<map>
#include<set>
#include<queue>
#include<vector>
using namespace std;
typedef long long ll;
typedef unsigned int uint;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef vector<int> VI;
#define fi first
#define se second
#define MP make_pair const int N=;
int a[N],n,m; int read()
{
int v=,f=;
char c=getchar();
while(c<||<c) {if(c=='-') f=-; c=getchar();}
while(<=c&&c<=) v=(v<<)+v+v+c-,c=getchar();
return v*f;
} int main()
{
//freopen("1.in","r",stdin);
//freopen("1.out","w",stdout);
scanf("%d%d",&n,&m);
for(int i=;i<=n;i++)
{
int x,y;
scanf("%d%d",&x,&y);
for(int j=x;j<=y;j++) a[j]=;
}
int ans=;
for(int i=;i<=m;i++) ans+=a[i];
printf("%d\n",m-ans);
for(int i=;i<=m;i++)
if(!a[i]) printf("%d ",i);
return ;
}

【CF1015A】Points in Segments(签到)的更多相关文章

  1. 【CF429E】Points and Segments(欧拉回路)

    [CF429E]Points and Segments(欧拉回路) 题面 CF 洛谷 题解 欧拉回路有这样一个性质,如果把所有点在平面内排成一行,路径看成区间的覆盖,那么每个点被从左往右的覆盖次数等于 ...

  2. 【CF429E】Points and Segments 欧拉回路

    [CF429E]Points and Segments 题意:给你数轴上的n条线段$[l_i,r_i]$,你要给每条线段确定一个权值+1/-1,使得:对于数轴上的任一个点,所有包含它的线段的权值和只能 ...

  3. Codeforces Round #245 (Div. 2) A. Points and Segments (easy) 贪心

    A. Points and Segments (easy) Time Limit: 1 Sec  Memory Limit: 256 MB 题目连接 http://codeforces.com/con ...

  4. 『ACM C++』 Codeforces | 1066A - Points in Segments

    大一生活真 特么 ”丰富多彩“ ,多彩到我要忙到哭泣,身为班长,很多班级的事情需要管理,也是,什么东西都得体验学一学,从学生会主席.团委团总支.社团社长都体验过一番了,现在差个班长也没试过,就来体验了 ...

  5. Codeforces Round #501 (Div. 3) 1015A Points in Segments (前缀和)

    A. Points in Segments time limit per test 1 second memory limit per test 256 megabytes input standar ...

  6. CF429E Points and Segments

    链接 CF429E Points and Segments 给定\(n\)条线段,然后给这些线段红蓝染色,求最后直线上上任意一个点被蓝色及红色线段覆盖次数之差的绝对值不大于\(1\),构造方案,\(n ...

  7. [UCSD白板题] Points and Segments

    Problem Introduction The goal in this problem is given a set of segments on a line and a set of poin ...

  8. Codeforces Round #245 (Div. 2) A - Points and Segments (easy)

    水到家了 #include <iostream> #include <vector> #include <algorithm> using namespace st ...

  9. codeforces 430A Points and Segments (easy)(理解能力有待提高……)

    题目 //终于看懂题目了,,,, //一条线段里面不是每个坐标上都有要染色的点,所以为了满足条件,只能考虑那些给出坐标的点 //所以就要排序一下了,不能直接根据坐标0 1 0 1…… #include ...

随机推荐

  1. Java的日期类和日期格式化类

    日期类: Date date = new Date(); // 获取当前的系统时间 2 System.out.println("年份:"+ date.getYear()); Cal ...

  2. 笔记--Day2--python基础2

    一.鸡汤 1.提高自我修养 2.人丑就要多读书 3.多走走,开拓眼界 二.目录: 1.列表.元组操作 2.字符串操作 3.字典操作 dict是无序的 key必须是唯一的 4.集合操作 集合是一个无序的 ...

  3. 日志切割logrotate和定时任务crontab详解

    1.关于日志切割 日志文件包含了关于系统中发生的事件的有用信息,在排障过程中或者系统性能分析时经常被用到.对于忙碌的服务器,日志文件大小会增长极快,服务器会很快消耗磁盘空间,这成了个问题.除此之外,处 ...

  4. H5 JS判断客户端是否是iOS或者Android手机移动端

    <script type="text/javascript"> var u = navigator.userAgent; || u.indexOf(; //androi ...

  5. ccf 201712-2 游戏(Python实现)

    一.原题 问题描述 试题编号: 201712-2 试题名称: 游戏 时间限制: 1.0s 内存限制: 256.0MB 问题描述: 问题描述 有n个小朋友围成一圈玩游戏,小朋友从1至n编号,2号小朋友坐 ...

  6. Python 简单购物程序

    # Author:Eric Zhao# -*- coding:utf-8 -*-'''需求:启动程序后,让用户输入工资,然后打印商品列表允许用户根据商品编号购买商品用户选择商品后,检测余额是否够,够就 ...

  7. 多本Python极速入门最佳书籍,不可错过的Python学习资料!

    Python作为现在很热门的一门编程语言,介于Python的友好,许多的初学者都将其作为首选,为了帮助大家更好的学习Python,我筛选了2年内优秀的python书籍,个别经典的书籍扩展到5年内.   ...

  8. OpenCV中图像的BGR格式及Img对象的属性说明

    1. 图像的BGR格式说明 OpenCV中图像读入的数据格式是numpy的ndarray数据格式.是BGR格式,取值范围是[0,255]. 如下图所示,分为三个维度: 第一维度:Height 高度,对 ...

  9. Python头脑风暴3

    驾校是个暴利行业 如果有高学历靠谱的IT人员做驾校教练等等等等.... Python虽然难做企业级应用,但Python是全球个人自定义应用的首选!!!没有之一,所有语言最快的开发速度,最个性化的私人定 ...

  10. (转)iOS获取设备型号

    //获得设备型号 + (NSString *)getCurrentDeviceModel:(UIViewController *)controller { ]; size_t len; char *m ...