数据结构 树状数组
文章平均质量分 86
obsorb_knowledge
心有不甘,呼唤着我
展开
-
406. 根据身高重建队列(贪心+简洁代码的线段树优化)
题目描述: 假设有打乱顺序的一群人站成一个队列,数组 people 表示队列中一些人的属性(不一定按顺序)。每个 people[i] = [hi, ki] 表示第 i 个人的身高为 hi ,前面 正好 有 ki 个身高大于或等于 hi 的人。 请你重新构造并返回输入数组people 所表示的队列。返回的队列应该格式化为数组 queue ,其中 queue[j] = [hj, kj] 是队列中第 j 个人的属性(queue[0] 是排在队列前面的人)。 示例 1: 输入:people = [[7,0.原创 2021-02-22 20:22:14 · 636 阅读 · 0 评论 -
Tufurama CodeForces - 961E (树状数组 )
One day Polycarp decided to rewatch his absolute favourite episode of well-known TV series "Tufurama". He was pretty surprised when he got results only for season 7 episode 3 with his search query ...原创 2018-04-10 21:14:58 · 264 阅读 · 0 评论 -
Ultra-QuickSort POJ - 2299 (数状数组 线段树 归并排序 求逆序数)
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...原创 2018-04-10 09:19:48 · 258 阅读 · 0 评论 -
Group HDU - 4638(树状数组+离线处理)
There are n men ,every man has an ID(1..n).their ID is unique. Whose ID is i and i-1 are friends, Whose ID is i and i+1 are friends. These n men stand in line. Now we select an interval of men to make...原创 2018-05-01 16:30:55 · 227 阅读 · 0 评论 -
牛客网暑期ACM多校训练营(第一场)J Different Integers(树状数组 + 离线 或 莫队)
题目描述 Given a sequence of integers a1, a2, ..., an and q pairs of integers (l1, r1), (l2, r2), ..., (lq, rq), find count(l1, r1), count(l2, r2), ..., count(lq, rq) where count(i, j) is the number of ...原创 2018-08-21 15:48:56 · 155 阅读 · 0 评论