2012 #3 Flowers
Time Limit:2000MS Memory Limit:65536KB 64bit IO Format:%I64d & %I64u
Description
Input
For each case, the first line contains two integer N and M, where N (1 <= N <= 10^5) is the number of flowers, and M (1 <= M <= 10^5) is the query times.
In the next N lines, each line contains two integer S i and T i (1 <= S i <= T i <= 10^9), means i-th flower will be blooming at time [S i, T i].
In the next M lines, each line contains an integer T i, means the time of i-th query.
Output
Sample outputs are available for more details.
Sample Input
1 1
5 10
4
2 3
1 4
4 8
1
4
6
Sample Output
0
Case #2:
1
2
1
#include <stdio.h>
#include <string.h>
#include <algorithm>
using namespace std;
int main()
{
int T;
int i,j;
int n,m,ca=;
int l[],r[];
scanf("%d",&T);
while(T--)
{
scanf("%d %d",&n,&m);
for(i=;i<=n;i++)
scanf("%d %d",&l[i],&r[i]);
sort(l+,l+n+);
sort(r+,r+n+);
printf("Case #%d:\n",ca);ca++;
for(i=;i<=m;i++)
{
int x,y,z;
scanf("%d",&z);
x=upper_bound(l+,l+n+,z)-(l+);
y=upper_bound(r+,r+n+,z-)-(r+);
printf("%d\n",x-y);
}
}
return ;
}
2012 #3 Flowers的更多相关文章
- HDU 4325 Flowers(树状数组)
Flowers Time Limit: 4000/2000 MS (Java/Others) Memory Limit: 65536/65536 K (Java/Others)Total Sub ...
- (线段树 区间运算求点)Flowers -- hdu -- 4325
http://acm.hdu.edu.cn/showproblem.php?pid=4325 Flowers Time Limit: 4000/2000 MS (Java/Others) Mem ...
- NC24325 [USACO 2012 Mar S]Flowerpot
NC24325 [USACO 2012 Mar S]Flowerpot 题目 题目描述 Farmer John has been having trouble making his plants gr ...
- Windows server 2012 添加中文语言包(英文转为中文)(离线)
Windows server 2012 添加中文语言包(英文转为中文)(离线) 相关资料: 公司环境:亚马孙aws虚拟机 英文版Windows2012 中文SQL Server2012安装包,需要安装 ...
- Windows Server 2012 NIC Teaming介绍及注意事项
Windows Server 2012 NIC Teaming介绍及注意事项 转载自:http://www.it165.net/os/html/201303/4799.html Windows Ser ...
- 1.初始Windows Server 2012 R2 Hyper-V + 系统安装详细
干啥的?现在企业服务器都是分开的,比如图片服务器,数据库服务器,redis服务器等等,或多或少一个网站都会用到多个服务器,而服务器的成本很高,要是动不动采购几十台,公司绝对吃不消的,于是虚拟化技术出来 ...
- 0.Win8.1,Win10,Windows Server 2012 安装 Net Framework 3.5
后期会在博客首发更新:http://dnt.dkill.net 网站部署之~Windows Server | 本地部署:http://www.cnblogs.com/dunitian/p/482280 ...
- windows 2012 r2 can't find kb2919355
问题 解决: 1.手动安装了 Windows8.1-KB2919442-x64 2.手动下载 KB2919355 更新成功 Turns out to have been a result ...
- Windows Server 2012 磁盘管理之 简单卷、跨区卷、带区卷、镜像卷和RAID-5卷
今天给客户配置故障转移群集,在Windows Server 2012 R2的系统上,通过iSCSI连接上DELL的SAN存储后,在磁盘管理里面发现可以新建 简单卷.跨区卷.带区卷.镜像卷.RAID-5 ...
随机推荐
- 夺命雷公狗---Thinkphp----3之后台搭建
我们这里来搭建我们网站所需要用到的后台: 我们直接打开WEB目录,然后直接赋值Home文件粘贴并改名为Admin,效果如下所示: 然后修改他的控制器: 代码修改成如下所示: <?php name ...
- XAMPP和Bugfree详细教程
一.XAMPP安装配置 xampp是一款跨平台的集成 apache + mysql + php环境,是的配置AMP服务器变得简单轻松,支持windows,solaris, 下载地址:http://so ...
- Android 二维码扫描框 加四个角及中间横线自动下滑
红色为加四个角 黄色为扫描线自动下滑 /* * Copyright (C) 2008 ZXing authors * * Licensed under the Apache License, Ver ...
- unix
BSD (Berkeley Software Distribution,伯克利软件套件)是Unix的衍生系统,在1977至1995年间由加州大学伯克利分校开发和发布的.历史上, BSD曾经被认为是UN ...
- iOS录音加播放.
现在发现的事实有: 如果没有蓝牙设备, 那么可以用下面的方法边录音, 边放音乐: 在录音按钮按下的时候: _avSession = [AVAudioSession sharedInstance]; ...
- arduino 红外遥控器控制LED灯
/* 日期:2016.9.1 功能:红外遥控器控制LED灯 开,关,闪烁,呼吸 元件: 跳线公公头 * 5 led 220欧电阻 红外接收管,红外遥控 接线: 红外灯面向自己从左到右分别接 IO3 , ...
- centos7.0 没有netstat 和 ifconfig命令问题
yum install wget 运行 yum install net-tools 就OK了 默认CentOS已经安装了OpenSSH,即使你是最小化安装也是如此.所以这里就不介绍OpenSSH的 ...
- Android推送方案分析(MQTT/XMPP/GCM)
本文主旨在于,对目前Android平台上最主流的几种消息推送方案进行分析和对比,比较客观地反映出这些推送方案的优缺点,帮助大家选择最合适的实施方案. 方案1. 使用GCM服务(Google Cloud ...
- function adapter(函数适配器)和迭代器适配器
所谓function adapter(函数适配器)是指能够将不同的函数对象(或是和某值或某寻常函数)结合起来的东西,它自身也是个函数对象. 迭代器适配器 运用STL中的迭代器适配器,可以使得算法能够 ...
- hashMap底层put和get方法逻辑
1.hashmap put方法的实现: public V put(K key, V value) { if (key == null) return putForNullKey(value); int ...