hdu 1050 (preinitilization or postcleansing, std::fill) 分类: hdoj 2015-06-18 11:33 34人阅读 评论(0) 收藏
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) 收藏的更多相关文章
- 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 ...
- 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 ...
- Least Common Ancestors 分类: ACM TYPE 2014-10-19 11:24 84人阅读 评论(0) 收藏
#include <iostream> #include <cstdio> #include <cstring> #include <cmath> #i ...
- 二分图匹配(KM算法)n^4 分类: ACM TYPE 2014-10-04 11:36 88人阅读 评论(0) 收藏
#include <iostream> #include<cstring> #include<cstdio> #include<cmath> #incl ...
- 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) ...
- 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 ...
- 实现字符串的查找和替换 分类: c/c++ 2014-10-09 22:33 469人阅读 评论(0) 收藏
在字符串中查找目标字符串并将其替换为指定字符串,返回替换的次数.接口为 int find_str_replace(char *&str,const char *find_str,const c ...
- 基于命令行编译打包phonegap for android应用 分类: Android Phonegap 2015-05-10 10:33 73人阅读 评论(0) 收藏
也许你习惯了使用Eclipse编译和打包Android应用.不过,对于使用html5+js开发的phonegap应用,本文建议你抛弃Eclipse,改为使用命令行模式,绝对的快速和方便. 一直以来,E ...
- 8大排序算法图文讲解 分类: Brush Mode 2014-08-18 11:49 78人阅读 评论(0) 收藏
排序算法可以分为内部排序和外部排序,内部排序是数据记录在内存中进行排序,而外部排序是因排序的数据很大,一次不能容纳全部的排序记录,在排序过程中需要访问外存. 常见的内部排序算法有:插入排序.希尔排序. ...
随机推荐
- Dundas控件的X轴字体竖排版
dundas 坐标轴的问题 x轴的值怎么让他竖排显示?我晓得dundas可以旋转显示,但是不是我要的效果 如下 --------------------------------------- 第 ...
- stack overflow--技术问答网站
转自:http://baike.baidu.com/link?url=eMR6Pwdk9IkauI5B3nZb2Yo3VUAcK6vQfrMpcSMPWqgH0ngqFkup3Gdr3t_s_yZe_ ...
- python 学习笔记十三 JQuery(进阶篇)
jQuery 是一个 JavaScript 库. jQuery 极大地简化了 JavaScript 编程. 安装jQuery 有两个版本的 jQuery 可供下载: Production versio ...
- <转>linux crontab 定时任务
基本格式 : * * * * * command 分 时 日 月 周 命令 第1列表示分钟1-59 每分钟用*或者 */1表示 第2列表示小时1-23(0表示0点) 第3列表示日期1-31 ...
- 。【自学总结 3】------3ds Max 主工具栏
1.选择并链接:选择对象,使其和其他对象建立父子关系. 2.断开选择链接:撤销链接关系. 3.选择过滤器列表:可以限制要选择的对象的特定类型和组合.例如,我们选择几何体后,其他对象就无法被选择. 4. ...
- c++ ado 调用存储过程并得到输出参数和返回值
// AccessSqlserverByAdo.cpp : 定义控制台应用程序的入口点. // #include "stdafx.h" #include <Windows.h ...
- 深入理解CSS网页布局-理论篇
在CSS网页开发布局中,需要对浮动和定位有深刻的理解才能在开发中游刃有余. 基于此,在博客园中做了本篇总结,这些总结来自实践经验和阅读一些书籍后的理解总结,主要内容为浮动,清除浮动,定位. (可点击屏 ...
- springMVC简单示例
1.新建web工程 2.引入springframework架包 3.配置文件 web.xml <?xml version="1.0" encoding="UTF-8 ...
- A replacement solution to using Google Drive in Ubuntu
Grive2 Get dependencies You need to get the dependency libraries along with their development (-dev ...
- Java处理excel文件
好久好久没写blog了,感觉都生锈了,最近弄了弄java处理excel,特来简单粘贴一下: package excel; import java.io.BufferedInputStream; imp ...