码迷,mamicode.com
首页 >  
搜索关键字:区间    ( 16036个结果
POJ - 2689 Prime Distance(大区间素数筛选)
Description The branch of mathematics called number theory is about properties of numbers. One of the areas that has captured the interest of number theoreticians for thousands of years is the qu...
分类:其他好文   时间:2014-11-05 00:33:10    阅读次数:200
《github一天一道算法题》:并归排序
看书、思考、写代码! /******************************************* * copyright@hustyangju * blog: http://blog.csdn.net/hustyangju * 2014-11-04 * 题目:并归排序 * 描述:中分法递归分解一个区间的数组,再合并子区间,在合并时完成排序 * 解题思路:递归法,利用临界...
分类:编程语言   时间:2014-11-04 22:45:13    阅读次数:211
POJ 3237 Tree 树链剖分
单点替换,区间取相反数,区间求最大值,其实线段树里面只要保存最小值和最大值就可以了,取反之后最小值变成最大值最大值变成最小值。#include #include #include #include #include #include #include #include #include #inclu...
分类:其他好文   时间:2014-11-04 22:35:00    阅读次数:202
POJ 2763 Housewife Wind 树链剖分
点更新,区间询问和,最基础的树链剖分。#include #include #include #include #include #include #include #include #include #include #include #include using namespace std;#de...
分类:Windows程序   时间:2014-11-04 22:28:00    阅读次数:257
leetcode Insert Interval
题目:给定一系列的区间,这些区间是不重合的,而且按每个区间的起始点排好序了。再来一个区间。怎么得到所有合并后的区间。Example 1:Given intervals[1,3],[6,9], insert and merge[2,5]in as[1,5],[6,9].Example 2:Given[...
分类:其他好文   时间:2014-11-04 22:20:44    阅读次数:222
hdu 4407 Sum(容斥)
http://acm.hdu.edu.cn/showproblem.php?pid=4407 起初有n个数1~n,这里有m个操作,两种类型。操作1:求出[x,y]区间内与p互质的数的和。操作2:将第x位置的数变成y。对于每一个询问,输出结果。 因为只有1000次操作,而且起初是有序的。那么对于第i个询问,我们先忽略i之前的所有的第2种操作,即认为n个数为1~n,根据容斥原理求出...
分类:其他好文   时间:2014-11-04 21:12:44    阅读次数:269
hdu--3275--线段树<again>
又加强了 对线段树 延迟标记的理解~~题意很简单 给你一串数字01组成. 每次必须操作K个数 将其翻转 即0->1 1->0 就相当 对于一段区间 [ L , L+K-1 ] 的0和1的数量 进行swap操作首先 解这题 一点必须想到 求最少操作次数 肯定是从最左边开始.那么我每次 query(fi...
分类:其他好文   时间:2014-11-04 21:08:19    阅读次数:220
Linux 笔记--文本
uniq-i忽略大小写-c进行计数-fN前 N 个区域被忽略wc行 字数 字符数-l仅列出行-w仅列出多少字-m多少字符cut-d后接分割字符,与-f 一起使用-f用-f 去第几段-c以字符的单位取出固定字符区间echo $PATH/usr/local/bin:/usr/bin:/bin:/usr/...
分类:系统相关   时间:2014-11-04 21:07:08    阅读次数:197
hdu1828(线段树+扫描线)
又知道了线段树的一种用法,除了单点更新,区间更新,还有这种在一段线段上标号但不往下推。 真是神奇hdu1828#include #include #include #include #include #include #include #include #include using namespac...
分类:其他好文   时间:2014-11-04 19:28:44    阅读次数:170
BZOJ 3207 花神的嘲讽计划Ⅰ Hash+可持久化线段树
题目大意:给出一个序列,问一个区间里有没有长度为定长的已知序列。 思路:第一步的想法是把序列哈希一下,如果暴力的话,就是在区间里面O(n)的去判断,但是这样显然太慢了,我们需要O(logn)的时间之内求出区间内有没有一个值。这个问题就可以用可持久化线段树或者划分树来解决了。划分树我不咋会,就写了可持久化线段树。代码略丑,见谅。 CODE: #include #inclu...
分类:其他好文   时间:2014-11-04 17:34:01    阅读次数:120
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!