
线段树
鸩羽小夜
我是小垃圾,垃圾中的战斗圾
展开
-
POJ3067Japan(线段树+逆序对)
Japan plans to welcome the ACM ICPC World Finals and a lot of roads must be built for the venue. Japan is tall island with N cities on the East coast and M cities on the West coast (M <= 1000, N &l...原创 2019-11-20 17:44:56 · 319 阅读 · 0 评论 -
POJ2299Ultra-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 i...原创 2019-11-20 09:10:40 · 157 阅读 · 0 评论 -
POJ3264Balanced 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 ...原创 2019-11-19 12:01:29 · 100 阅读 · 0 评论 -
HDU1754I hate it(区间查询,单点修改)
很多学校流行一种比较的习惯。老师们很喜欢询问,从某某到某某当中,分数最高的是多少。这让很多学生很反感。不管你喜不喜欢,现在需要你做的是,就是按照老师的要求,写一个程序,模拟老师的询问。当然,老师有时候需要更新某位同学的成绩。Input本题目包含多组测试,请处理到文件结束。在每个测试的第一行,有两个正整数 N 和 M ( 0<N<=200000,0<M<5...原创 2019-11-19 11:56:37 · 130 阅读 · 0 评论 -
HDU2795Billboard(线段树,单点修改)
At the entrance to the university, there is a huge rectangular billboard of size h*w (h is its height and w is its width). The board is the place where all possible announcements are posted: nearest p...原创 2019-11-19 11:51:32 · 104 阅读 · 0 评论 -
HDU4027Can you answer these queries? (线段树区间查询+区间修改)
A lot of battleships of evil are arranged in a line before the battle. Our commander decides to use our secret weapon to eliminate the battleships. Each of the battleships can be marked a value of end...原创 2019-11-18 21:19:24 · 160 阅读 · 0 评论 -
HDU1394 Minimum Inversion Number (线段树,单点修改*,区间查询*,逆序数)
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 f...原创 2019-11-11 22:01:48 · 218 阅读 · 0 评论 -
POJ2777Count Color (线段树区间修改+查询,或运算,二进制)
Chosen Problem Solving and Program design as an optional course, you are required to solve all kinds of problems. Here, we get a new problem.There is a very long board with length L centimeter, L is...原创 2019-11-06 20:19:35 · 189 阅读 · 0 评论 -
HDU3577Fast Arrangement(最大值线段树+区间更新)
Chinese always have the railway tickets problem because of its' huge amount of passangers and stations. Now goverment need you to develop a new tickets query system.One train can just take k passang...原创 2019-11-04 21:48:39 · 142 阅读 · 0 评论 -
线段树(区间数)模板
建树模板static void build_tree(int node,int start,int end){//建立线段树 if(start==end){//递归终止条件,树范围为1,直接将值赋值给叶节点 tree[node]=arr[start]; return; } int mid=(start+end)>>1;//划分左右子树的范围 in...原创 2019-11-04 12:46:04 · 137 阅读 · 0 评论 -
POJ3468A 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 ...原创 2019-11-04 12:28:26 · 105 阅读 · 0 评论