![](https://img-blog.csdnimg.cn/20201014180756928.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
线段树
ffutop
这个作者很懒,什么都没留下…
展开
-
Codeforces Round #381 (Div. 2) E. Alyona and towers
Codeforces Round #381 (Div. 2) E. Alyona and towersDescriptionAlyona has built n towers by putting small cubes some on the top of others. Each cube has size 1 × 1 × 1. A tower is a non-zero amount of c原创 2016-11-27 10:54:21 · 432 阅读 · 0 评论 -
Codeforces Round #413 C. Fountains(RMQ线段树)
Arkady plays Gardenscapes a lot. Arkady wants to build two new fountains. There are n available fountains, for each fountain its beauty and cost are known. There are two types of money in the game: coi原创 2017-05-13 09:30:17 · 698 阅读 · 2 评论 -
HDU 5289 Assignment (线段树)
Problem DescriptionTom owns a company and he is the boss. There are n staffs which are numbered from 1 to n in this company, and every staff has a ability. Now, Tom is going to assign a special task to原创 2017-05-15 13:25:29 · 527 阅读 · 0 评论 -
Codeforces Round #426 (Div. 1) B. The Bakery (DP + 线段树)
Problem将 N 长序列划分 K 块的最大价值和。每块的价值定义为该段区间内的不同数的个数。其中 N 长序列的每个数为 a1,a2,⋯,ana_1, a_2,\cdots,a_nLimit1≤N≤350001\le N \le 350001≤K≤min(n,50)1\le K \le \min(n, 50)1≤ai≤N1\le a_i \le NIdea从数据限制来看,此题的复杂度一般应该在 O原创 2017-07-31 14:10:34 · 696 阅读 · 0 评论 -
Codeforces 838B. Diverging Directions (LCA+线段树, IndiaHacks 2nd Elimination 2017 )
ProblemYou are given a directed weighted graph with n nodes and 2*n* - 2 edges. The nodes are labeled from 1 to n, while the edges are labeled from 1 to 2*n* - 2. The graph’s edges can be split into tw原创 2017-08-08 09:44:30 · 552 阅读 · 0 评论 -
HDU 6070 Dirt Ratio (二分+线段树, 2017 Multi-Univ Training Contest 4)
ProblemN 长区间每个数为 aia_i,任取一段区间,定义 X 表示所取区间不相同数个数,Y 表示所取区间长度,求最小 XY\frac{X}{Y} 。Limit1≤n≤600001\le n \le 600001≤ai≤n1\le a_i\le nIdea感觉比赛时候各种乱来。挂机 4 小时想不出这题的正解…对答案进行二分枚举(:cry: 很显然有二分性,我竟然一开始就否定了)。对每次二分的答原创 2017-08-04 10:06:45 · 414 阅读 · 0 评论 -
HDU 6194 String String String (后缀数组+线段树, 2017 ACM/ICPC Asia Regional Shenyang Online)
Problem求字符串 S 中严格出现 k 次的子串个数k≥1k\ge 1|S|≤105|S|\le 10^5∑|S|≤2×106\sum |S| \le 2\times 10^6Idea貌似很多队都是用后缀树 AC 的。好吧,我不会。后缀数组 + 线段树 解法:利用后缀数组处理出 height[] 数组,显然 height[i] 表示 sa[i] 与 sa[i-1] 的最长公共前缀(LCP) 。利原创 2017-09-11 08:29:27 · 1605 阅读 · 3 评论