这道题是rmq,再加上一个解决溢出。刚开始我也想过用rmq,虽然不知道它叫什么,但是我知道应该这样做。可是后来没想到这道题的特殊性,也就是解决溢出的方法,就放弃了。rmq可以用线段树,也可以用dp。 这道题都可以过的,而且线段树要快一些。#include #include #include #inc...
分类:
其他好文 时间:
2014-07-19 15:16:36
阅读次数:
251
判断两直线p1p2与q1q2是否相交,用向量叉积来判断如果P x Q >0,则P在Q的顺时针方向;如果P x Q #include #include #include #include typedef struct node{ double x,y;}point;point p1,p2,q1,...
分类:
其他好文 时间:
2014-07-19 09:38:36
阅读次数:
279
hdu4521:http://acm.hdu.edu.cn/showproblem.php?pid=4521题解:给你一个序列,然后让你找一个最长上升子序列,但是这个最长上升子序列的数在原来序列的间隔不少于d。题解:如果没有d的要求就是一个求最长上升子序列。这里用线段树可以来优化。以数的值来建树。维...
分类:
其他好文 时间:
2014-07-19 09:34:12
阅读次数:
283
Mobile phonesTime Limit:5000MSMemory Limit:65536KTotal Submissions:14391Accepted:6685DescriptionSuppose that the fourth generation mobile phone base s...
分类:
其他好文 时间:
2014-07-19 09:23:02
阅读次数:
175
A Simple Problem with IntegersTime Limit:5000MSMemory Limit:131072KTotal Submissions:58269Accepted:17753Case Time Limit:2000MSDescriptionYou haveNinte...
分类:
其他好文 时间:
2014-07-18 23:17:23
阅读次数:
232
线段树:延伸标记+暴力更新
记得刚学线段树的时候做这题WA了一版。。。。。现在分分钟搞定。。。。
Count the Colors
Time Limit: 2 Seconds Memory Limit: 65536 KB
Painting some colored segments on a line, some previously painted segm...
分类:
其他好文 时间:
2014-07-18 23:07:26
阅读次数:
330
DZY Loves Fibonacci NumbersTime Limit:4000MSMemory Limit:262144KB64bit IO Format:%I64d & %I64uSubmitStatusAppoint description:DescriptionIn mathematic...
分类:
其他好文 时间:
2014-07-18 19:05:07
阅读次数:
305
【原题】
3333: 排队计划
Time Limit: 20 Sec Memory Limit: 128 MB
Submit: 161 Solved: 71
[Submit][Status]
Description
Input
Output
Sample Input
6 2
160 163 164 161 167 160 ...
分类:
其他好文 时间:
2014-07-18 14:07:18
阅读次数:
288
题目链接: http://acm.hdu.edu.cn/showproblem.php?pid=1394解题报告:给出一个序列,求出这个序列的逆序数,然后依次将第一个数移动到最后一位,求在这个过程中,逆序数最小的序列的逆序数是多少?这题有一个好处是输入的序列保证是0 到 n-1,所以不许要离散化,....
分类:
其他好文 时间:
2014-07-17 13:14:23
阅读次数:
283
Description
Byteman, one of the most deserving employee of The Goldmine of Byteland, is about to retire by the end of the year. The Goldmine management would like to reward him in acknowledgment...
分类:
其他好文 时间:
2014-07-17 10:24:12
阅读次数:
307