上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 15 下一页

2015年8月16日

HDU 1025-Constructing Roads In JGShining's Kingdom(最长不降子序列,线段树优化)

摘要: 分析:最长不降子序列,n很大o(n^2)肯定超,想到了小明序列那个题用线段树维护前面的最大值即可该题也可用二分搜索来做。注意问题输出时的坑,路复数后加s#include #include #include #include #include #include #include #include #i... 阅读全文

posted @ 2015-08-16 17:42 积跬步、至千里 阅读(142) 评论(0) 推荐(0) 编辑

HDU 3584-Cube(三维BIT)

摘要: 题意:给你三维空间两种操作,给出两顶点坐标,把它们确定范围(长方体)内的数全部取反、查询给定点的值。初始全部为零分析:有了前面的知识,用BIT实现区间更新单点查询,再用多维实现即可#include #include #include #include #include #include #inclu... 阅读全文

posted @ 2015-08-16 17:34 积跬步、至千里 阅读(158) 评论(0) 推荐(0) 编辑

POJ 1195- Mobile phones(二维BIT)

摘要: 题意:矩阵上的单点更新,范围求和#include #include #include #include #include #include #include #include #include #include #include #include #include #include #include... 阅读全文

posted @ 2015-08-16 17:26 积跬步、至千里 阅读(234) 评论(0) 推荐(0) 编辑

HDU 1892-See you(二维BIT)

摘要: 题意:最多1000*1000的方格,各方格开始有一本书有四种操作:对指定方格把书拿走或向里面放书,从一个方格那一定量的书放到另一个方格,查询给定对角线顶点的坐标的矩形范围内包含的书的总数分析:二维BIT,注意方格的书数小于拿书数量的情况#include #include #include #incl... 阅读全文

posted @ 2015-08-16 17:24 积跬步、至千里 阅读(309) 评论(0) 推荐(0) 编辑

HDU 4267-A Simple Problem with Integers(多个BIT)

摘要: 题意:2种操作1 a b k c 在区间[a,b]中的(i-a)%k==0的位置i上的数+c2 a 查询位置a的值输出每次查询的值分析:开始想到多维的线段树,但比较麻烦,看了题解才知道,用BIT实现区间更新,单点查询,若在区间[a,b]上的数加c就在a位置加c ,b+1位置加-c 这样在查询时sum... 阅读全文

posted @ 2015-08-16 17:14 积跬步、至千里 阅读(144) 评论(0) 推荐(0) 编辑

HDU 4325-Flowers(线段树+离散化)

摘要: 题意:给出每个花开花的时间段,每询问一个时间点输出该时间点开花的数量分析:线段树的区间更新,单点查询,但发现时间很大,没法存区间,就想到了离散化。离散化就是把要处理的数据统一起来重新标号。#include #include #include #include #include #include #i... 阅读全文

posted @ 2015-08-16 16:55 积跬步、至千里 阅读(94) 评论(0) 推荐(0) 编辑

HDU 2222 (AC自动机模板题)

摘要: 题意:给一个文本串和多个模式串,求文本串中一共出现多少次模式串分析:ac自动机模板,关键是失配函数#include #include #include #include #include #include #include #include #include #include #include #i... 阅读全文

posted @ 2015-08-16 16:43 积跬步、至千里 阅读(155) 评论(0) 推荐(0) 编辑

Period(KMP,循环节问题)

摘要: 题意:求给你个串,前i位子串由某个字符串重复k次得到,求所有的i和k分析:i-next[i]恰好是一个循环节#include #include #include #include #include #include #include #include #include #include #inclu... 阅读全文

posted @ 2015-08-16 16:37 积跬步、至千里 阅读(203) 评论(0) 推荐(0) 编辑

Number Sequence(KMP,判断子串 模板)

摘要: 题意:给两数组,求一个是否是另一个的子数组,若是返回匹配的首位置分析:KMP 入门//扫描字符串A,并更新可以匹配到B的什么位置。#include #include #include #include #include #include #include #include #include #inc... 阅读全文

posted @ 2015-08-16 16:32 积跬步、至千里 阅读(204) 评论(0) 推荐(0) 编辑

2015年8月10日

UVA 12532-Interval Product(BIT)

摘要: 题意:给n个数字的序列,C v p 把v位上的数字置成p , S l r代表求区间[l,r]各数字相乘得数的符号,对于每个S输出所得符号(’+‘,’-‘,’0‘)分析:开两个数组表示区间负数的个数、0的个数、当数字被改时,更新数组、查询时区间含0符号是0,再根据负数的个数的奇偶判断。#include... 阅读全文

posted @ 2015-08-10 20:14 积跬步、至千里 阅读(139) 评论(0) 推荐(0) 编辑

上一页 1 ··· 5 6 7 8 9 10 11 12 13 ··· 15 下一页

导航