
线段树
ting9933
这个作者很懒,什么都没留下…
展开
-
树状数组
校门外有很多树,学校决定在某个时刻在某一段种上一种树,保证任一时刻不会出现两段相同种类的树,现有两种操作: K=1,读入l,r表示在l到 r之间种上一种树,每次操作种的树的种类都不同; K=2,读入 l,r表示询问 l到 r之间有多少种树。 注意:每个位置都可以重复种树。 输入格式 第一行表示道路总长为 n,共有m个操作; 接下来 m行为 m个操作。 输出格式 对于每个 K=2输出一个答案。 样例 样例输入 5 4 1 1 3 2 2 5 1 2 4 2 3 ...原创 2021-02-23 20:10:57 · 209 阅读 · 1 评论 -
Ultra-QuickSort -带权线段树
In this problem, you have to analyze a particular sorting algorithm. The algorithm processes a sequence of n distinct integers by swapping two adjacent sequence elements until the sequence is sorted in ascending order. For the input sequence 9 1 0 5 4 , .原创 2020-08-21 15:35:43 · 211 阅读 · 0 评论 -
Just a Hook -线段树-更换再求和
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 wants to do some operations on the hook. Let us numb..原创 2020-08-20 18:47:59 · 187 阅读 · 0 评论 -
A Simple Problem with Integers -线段树-求和与查询
You haveNintegers,A1,A2, ... ,AN. You need to deal with two kinds of operations. One type of operation is to add some given number to each number in a given interval. The other is to ask for the sum of numbers in a given interval. Input The first li...原创 2020-08-20 18:33:06 · 128 阅读 · 0 评论 -
Balanced Lineup -线段树-求区间最大最小值
For the daily milking, Farmer John'sNcows (1 ≤N≤ 50,000) always line up in the same order. One day Farmer John decides to organize a game of Ultimate Frisbee with some of the cows. To keep things simple, he will take a contiguous range of cows from the...原创 2020-08-20 16:38:07 · 194 阅读 · 0 评论