![](https://img-blog.csdnimg.cn/20201014180756918.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
线段树
至此曾经
从未坚持?
展开
-
hdu 6183 【线段树的巧妙】
Do you like painting? Little D doesn't like painting, especially messy color paintings. Now Little B is painting. To prevent him from drawing messy painting, Little D asks you to write a program to ma原创 2017-09-28 20:44:23 · 240 阅读 · 0 评论 -
hdu 5685 Problem A
Problem Description度熊手上有一本字典存储了大量的单词,有一次,他把所有单词组成了一个很长很长的字符串。现在麻烦来了,他忘记了原来的字符串都是什么,神奇的是他竟然记得原来那些字符串的哈希值。一个字符串的哈希值,由以下公式计算得到:H(s)=∏i≤len(s)i=1(Si−28) (mod 9973)Si代表 S[i] 字符的 ASCII 码。请帮助原创 2016-11-22 16:55:43 · 208 阅读 · 0 评论 -
hdu 1394 Minimum Inversion Number
Problem DescriptionThe inversion number of a given number sequence a1, a2, ..., an is the number of pairs (ai, aj) that satisfy i aj.For a given sequence of numbers a1, a2, ..., an, if we move th原创 2016-11-13 20:21:34 · 204 阅读 · 0 评论 -
Nowcoder 第十四届华中科技大学程序设计竞赛决赛同步赛 M
It’s universally acknowledged that there’re innumerable trees in the campus of HUST. In 8102, Alisa took fishing as her business. When she was walking along the bank and forgot the distance gradually,...原创 2018-05-08 12:38:41 · 395 阅读 · 3 评论 -
2018 Multi-University Training Contest 2 Naive Operations
题意:In a galaxy far, far away, there are two integer sequence a and b of length n.b is a static permutation of 1 to n. Initially a is filled with zeroes.There are two kind of operations:1. add ...原创 2018-07-31 16:57:00 · 119 阅读 · 0 评论 -
2018 Multi-University Training Contest 5 Glad You Came
题目:http://acm.hdu.edu.cn/showproblem.php?pid=6356用线段树维护一个最小最大值搞一下可以过:#include<iostream>#include<stdio.h>#include<string.h>#include<algorithm>#include<vector>#de...原创 2018-08-06 21:19:47 · 124 阅读 · 0 评论 -
2018 Multi-University Training Contest 10 - Problem E. TeaTree (树上 dsu // 线段树合并)
题目:http://acm.hdu.edu.cn/showproblem.php?pid=6430题意:一棵树上每个节点权值为v[i],每个节点的heard值是:以它为LCA的两个节点的GCD的最大值,要求输出每个节点的heard值题解:小于 100000 的数最多只有一百多个约数. 建出所有点的约数线段树, 然后线段树合并, 重复的单点就可以对答案产生贡献. 当然有省内存的做法, DSU...原创 2018-08-24 15:12:50 · 153 阅读 · 0 评论