【CF1015A】Points in Segments(签到)
2024-09-29 06:04:19
题意:有一条上面有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 ;
}
最新文章
- Jquery Mobile中pageinit等函数执行两次的问题【终极解决】
- jQuery的常用事件
- Linux suse x86_64 环境上部署Hadoop启动失败原因分析
- (转)数据库SQL优化大总结之 百万级数据库优化方案
- struts2_4_为Action属性注入值
- 震荡信号Simulink仿真
- javamail发邮件
- hdu3944
- 【中间件安全】IIS6安全加固规范
- centos 7 查询mysql 安装 运行位置
- 使用PsExec获取shell执行命令
- laravel中artisan的用法
- 本地项目 共享 到github仓库
- IIS7.5中调试.Net 4.0网站出现无厘头500错误的解决办法 (转)
- Apache Spark Exception in thread “main” java.lang.NoClassDefFoundError: scala/collection/GenTraversableOnce$class
- TFS对签入文件忽略设置,解决pdb弹出警告
- Java的BIO,NIO,AIO
- 解决新版本webpack vue-cli生成文件没有dev.server.js问题
- Makefile生成器,使用C++和Boost实现
- Cassandra 在CQL中使用函数