errors, clauses in place, logical ones, should be avoided.

#include <cstdio>
#include <cstring>
#include <algorithm> int main() {
//freopen("input.txt","r",stdin);
const int CorNum=201;
int ncase, npair, to,from, first,last, res;
int shared[CorNum]={0};
if(scanf("%d",&ncase)!=1) return -1;
while(ncase-- && scanf("%d",&npair)==1) {
first=CorNum, last=0;
while(npair--) {
scanf("%d%d",&from,&to);
from=(from-1)>>1; to=(to-1)>>1;
if(from>to) std::swap(from,to);
first=std::min(first,from); last=std::max(last,to);
for(;from<=to;++from) ++shared[from];
}
for(res=0,from=first;from<=last;++from) res=std::max(res,shared[from]);
std::fill(&shared[first],&shared[last+1],0);
printf("%d\n",res*10);
}
return 0;
}

版权声明:本文为博主原创文章,未经博主允许不得转载。// p.s. If in any way improment can be achieved, better performance or whatever, it will be well-appreciated to let me know, thanks in advance.

hdu 1050 (preinitilization or postcleansing, std::fill) 分类: hdoj 2015-06-18 11:33 34人阅读 评论(0) 收藏的更多相关文章

  1. Hdu 1507 Uncle Tom's Inherited Land* 分类: Brush Mode 2014-07-30 09:28 112人阅读 评论(0) 收藏

    Uncle Tom's Inherited Land* Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 K (J ...

  2. Hdu 1506 Largest Rectangle in a Histogram 分类: Brush Mode 2014-10-28 19:16 93人阅读 评论(0) 收藏

    Largest Rectangle in a Histogram Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65536/32768 ...

  3. Least Common Ancestors 分类: ACM TYPE 2014-10-19 11:24 84人阅读 评论(0) 收藏

    #include <iostream> #include <cstdio> #include <cstring> #include <cmath> #i ...

  4. 二分图匹配(KM算法)n^4 分类: ACM TYPE 2014-10-04 11:36 88人阅读 评论(0) 收藏

    #include <iostream> #include<cstring> #include<cstdio> #include<cmath> #incl ...

  5. Beautiful People 分类: Brush Mode 2014-10-01 14:33 100人阅读 评论(0) 收藏

    Beautiful People Time Limit: 10000/5000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others)   ...

  6. Segment Tree with Lazy 分类: ACM TYPE 2014-08-29 11:28 134人阅读 评论(0) 收藏

    #include<stdio.h> #include<string.h> #include<algorithm> using namespace std; stru ...

  7. 实现字符串的查找和替换 分类: c/c++ 2014-10-09 22:33 469人阅读 评论(0) 收藏

    在字符串中查找目标字符串并将其替换为指定字符串,返回替换的次数.接口为 int find_str_replace(char *&str,const char *find_str,const c ...

  8. 基于命令行编译打包phonegap for android应用 分类: Android Phonegap 2015-05-10 10:33 73人阅读 评论(0) 收藏

    也许你习惯了使用Eclipse编译和打包Android应用.不过,对于使用html5+js开发的phonegap应用,本文建议你抛弃Eclipse,改为使用命令行模式,绝对的快速和方便. 一直以来,E ...

  9. 8大排序算法图文讲解 分类: Brush Mode 2014-08-18 11:49 78人阅读 评论(0) 收藏

    排序算法可以分为内部排序和外部排序,内部排序是数据记录在内存中进行排序,而外部排序是因排序的数据很大,一次不能容纳全部的排序记录,在排序过程中需要访问外存. 常见的内部排序算法有:插入排序.希尔排序. ...

随机推荐

  1. MongoDB数据库基本用法

    show dbs:显示数据库列表  show collections:显示当前数据库中的集合(类似关系数据库中的表)  show users:显示用户 use <db name>:切换当前 ...

  2. Oracle分组排序查询

    用sql查询每个分组中amount最大的前两条记录: SELECT *FROM HW trWHERE(SELECT COUNT(*) FROM HW WHERE tr.DEPID=DEPID AND ...

  3. HTML 事件属性

    HTML 事件属性一:定义二:窗口事件 (Window Events)三:表单元素事件 (Form Element Events)四:图像事件 (Image Events) 一:定义 HTML 4 的 ...

  4. 第三章 对象(JavaScript:语言精粹)

      对象是属性的容器,其中每个属性都有名字和值.   3.0. 概览:对象字面量 | 检索 | 更新 | 引用 | 原型 | 反射 | 枚举 | 删除 | 减少全局变量污染   3.1. 对象字面量 ...

  5. java编写一个可以上、下、左、右移动的坦克

    唉,本人学习进度缓慢,但依然会坚持不懈!有感兴趣的朋友可以在下面留言. 源代码献上: /* * 画出我的坦克,使他可以上下左右移动 */package com.test4; import javax. ...

  6. 个推,手机推送api的使用

    个推的作用:可以为手机端的app使用者推送消息,而不是通过手机上的app对用户发送消息.所以用户是被动的接收信息.当然不只是只有对用户弹出窗口的这种方式,也可以把信息推送给app,让app决定对用户实 ...

  7. 使用celery之深入celery配置(转)

    原文:http://www.dongwm.com/archives/shi-yong-celeryzhi-shen-ru-celerypei-zhi/ 前言 celery的官方文档其实相对还是写的很不 ...

  8. Delphi 文件类型

    该内容整理自以下链接 http://www.cnblogs.com/chenyunpeng/archive/2012/08/02/2620513.html 1.DPR: Delphi Project文 ...

  9. hibernate hibernate.cfg.xml component 组件

    1.为什么使用component组件? 当一个表的列数目比较多时,可以根据属性分类,将一个java对象拆分为几个对象. 数据库还是一张表,不过有多个对象与之对应. 2.实例 2.1 Java 对象: ...

  10. MyBatis中#,$的用法区别

    #可以防止SQL注入 $用在一些特殊的SQL语句例如 order by ${...} , desc/asc PS:大部分用#,一些特殊情况用$