n<=50000个区间,求哪个点被覆盖区间数量最多,输出这个数量。

差分模板。。然而数组忘开两倍。。

 #include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<algorithm>
#include<queue>
//#include<iostream>
using namespace std; int n;
#define maxn 100011
struct eve
{
int p,v;
bool operator < (const eve &b) const
{return p<b.p || (p==b.p && v<b.v);}
}e[maxn];int le=;
int x,y;
int main()
{
scanf("%d",&n);
for (int i=;i<=n;i++)
{
scanf("%d%d",&x,&y);
e[++le].p=x;e[le].v=;
e[++le].p=y+;e[le].v=-;
}
sort(e+,e++le);
int now=,ans=;
for (int i=;i<=le;i++)
{
now+=e[i].v;
ans=max(ans,now);
}
printf("%d\n",ans);
return ;
}

最新文章

  1. css伪类制作三角箭头
  2. ubuntu配置NFS
  3. 使用D3绘制图表(2)--绘制曲线
  4. [cb] Unity Editor 添加右键菜单
  5. HealthKit开发教程之HealthKit的复合数据
  6. FileUpload无法赋值解决方案
  7. No resource found that matches the given name
  8. 调试NodeJS应用
  9. 关于left join连接查询 两张表里有同名字段的问题
  10. MFC--自定义消息
  11. 添加&lt;!doctype html&gt;后造成JS写的定位失效
  12. SignalR的Javascript客户端API使用方式整合
  13. 20190326-HTML5标签、CSS的引用
  14. Python高级应用(3)—— 为你的项目添加验证码
  15. Spark核心RDD、什么是RDD、RDD的属性、创建RDD、RDD的依赖以及缓存、
  16. Struts自定义拦截器&amp;拦截器工作原理
  17. css的浮动
  18. MODBUS RTU协议中浮点数是如何存储,读到浮点数寄存器的数值如何转换成所需的浮点数
  19. 线段树之Sum
  20. sublime text 3103 怎么设置中文

热门文章

  1. iOS应用版本更新(自动提醒用户更新代码)
  2. 解决Ueditor在bootstarp 模态框中全屏问题
  3. 为Qt添加SSL支持
  4. innerHTML引起IE的内存泄漏
  5. win10忘记wifi记录
  6. oracle补丁类型
  7. (转)Spring+JDBC组合开发
  8. Zend Studio 修改“代码字体和大小”
  9. matlab 随笔
  10. EBS ORACLE工单齐套率的计算程序