
线段树
coldfresh
那我们开始吧
展开
-
操作格子(线段树)
线段树原创 2017-04-04 13:29:29 · 314 阅读 · 0 评论 -
Naive Operations【2018 Multi-University Training Contest 2 G题】(线段树)
Problem Description 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 oper...原创 2018-07-26 17:21:25 · 208 阅读 · 0 评论 -
线段树的合并
题目描述: 现在有一棵二叉树,所有非叶子节点都有两个孩子。在每个叶子节点上有一个权值(有n个叶子节点,满足这些权值为1..n的一个排列)。可以任意交换每个非叶子节点的左右孩子。 要求进行一系列交换,使得最终所有叶子节点的权值按照遍历序写出来,逆序对个数最少。 input: 第一行n 下面每行,一个数x 如果x==0,表示这个节点非叶子节点,递归地向下读入其左孩子和右孩子的信息, 如果...原创 2018-07-15 20:58:42 · 407 阅读 · 0 评论 -
Minimum Inversion Number HDU - 1394(权值线段树)
The inversion number of a given number sequence a1, a2, …, an is the number of pairs (ai, aj) that satisfy i < j and ai > aj. For a given sequence of numbers a1, a2, …, an, if we move the firs...原创 2018-07-15 19:35:01 · 275 阅读 · 0 评论 -
Digits Count FZU - 2105 (线段树)
Given N integers A={A[0],A[1],…,A[N-1]}. Here we have some operations:Operation 1: AND opn L RHere opn, L and R are integers.For L≤i≤R, we do A[i]=A[i] AND opn (here “AND” is bitwise operation)....原创 2018-04-13 20:07:20 · 295 阅读 · 0 评论 -
Cleaning Shifts POJ - 3171 (线段树优化dp)
Farmer John’s cows, pampered since birth, have reached new heights of fastidiousness. They now require their barn to be immaculate. Farmer John, the most obliging of farmers, has no choice but hire so...原创 2018-04-15 22:05:42 · 320 阅读 · 0 评论 -
New Year Tree CodeForces - 620E(dfs序+线段树)
The New Year holidays are over, but Resha doesn’t want to throw away the New Year tree. He invited his best friends Kerim and Gural to help him to redecorate the New Year tree.The New Year tree is a...原创 2018-03-19 18:11:27 · 317 阅读 · 0 评论 -
敌兵布阵 HDU-1166(线段树)
线段树原创 2017-03-30 23:45:57 · 560 阅读 · 0 评论 -
Just a Hook HDU - 1698(线段树的懒惰标记)
In the game of DotA, Pudge’s meat hook is actually the most horrible thing for most of the heroes. The hook is made up of several consecutive metallic sticks which are of the same length. Now Pudge wan原创 2017-07-02 14:40:15 · 552 阅读 · 0 评论 -
Crane(POJ-2991)(线段树)
ACM has bought a new crane (crane – jeřáb) . The crane consists of n segments of various lengths, connected by flexible joints. The end of the i-th segment is joined to the beginning of the i + 1-th on原创 2017-04-26 14:39:35 · 754 阅读 · 0 评论 -
【2019 南昌网络赛】Hello 2019(线段树、矩阵、dp)
A digital string is “good”: when it contains a subsequence 91029102 and does not contain a subsequence 81028102.The bad value of a string is defined as how many characters are to remove at least, so ...原创 2019-09-19 20:38:11 · 250 阅读 · 0 评论