
主席树
文章平均质量分 70
lwz_159
原acmer(已退役)
展开
-
2021牛客多校9 E.Eyjafjalla(dfs序+主席树)
题目描述There are n cities in the volcano country, numbered from 1 to n. The city 1 is the capital of the country, called Eyjafjalla. A large volcano is located in the capital, so the temperature there is quite high. The temperature of city i is denoted by t原创 2021-08-16 11:04:32 · 193 阅读 · 0 评论 -
The 17th Zhejiang Provincial Contest E. Easy DP Problem(主席树)
题目描述题目链接题目大意给你一个序列a[],以及q个查询。对于每个查询,给出l,r,k,要求以a[l-r]作为b[]数组求出 dp[r-l+1][k]的值。题目分析代码如下原创 2021-05-07 23:49:46 · 267 阅读 · 0 评论 -
第K小数(主席树+离散化)
题目描述给定长度为 N 的整数序列 A,下标为 1∼N。现在要执行 M 次操作,其中第 i 次操作为给出三个整数 li,ri,ki,求 A[li],A[li+1],…,A[ri] (即 A 的下标区间 [li,ri])中第 ki 小的数是多少。输入格式第一行包含两个整数 N 和 M。第二行包含 N 个整数,表示整数序列 A。接下来 M 行,每行包含三个整数 li,ri,ki,用以描述第 i 次操作。输出格式对于每次操作输出一个结果,表示在该次操作中,第 k 小的数的数值。每个结果原创 2021-04-08 20:39:40 · 299 阅读 · 0 评论 -
ICPC昆明 M.Stone Games(主席树)
题目描述There are nn piles of stones, the ii-th of which contains si stones. The tiles are numbered from 1 to n. Rika and Satoko are playing a game on it.During each round of the game, Rika chooses some piles from all n piles. Let denote the set of all chos原创 2021-04-08 20:34:01 · 492 阅读 · 0 评论