HBC13892Segment Tree题解

季陌殇 算法基础篇 53 0
题库丰富多样,涵盖各个领域,全网最全C++题库,让您在练习中不断成长!
Today HH is learning a new data structure named segment tree, which is often used to solve segment problem, here comes one: Gave you an unordered sequence of length n,(a1,a2,…,an), now you are supposed to calculate how many segment [L,R] are there satisfies two conditions : 1.the length of the segment is k. 2.the number between L and R appears at least q times in total. HH thinks the problem is too easy so he gives the problem to you.

Today HH is learning a new data structure  named segment tree, which is often used to solve segment problem, here comes one: Gave you an unordered sequence of length n,(a1,a2,…,an), now you are supposed to calculate how many segment [L,R](1≤L≤R) are there satisfies two conditions : 1.the length of the segment is k(i.e. R−L+1=k). 2.the number between L and R(both including) appears at least q times in total.  HH thinks the problem is too easy so he gives the problem to you.

HBC13892Segment Tree题解
-第1张图片-东莞河马信息技术
(图片来源网络,侵删)

标签: HBC13892Segment Tree题解