主席树
文章平均质量分 87
主席树
_sky123_
这个作者很懒,什么都没留下…
展开
-
2021ICPC河南省赛 C.Alice and Bob
Alice 和 Bob 在玩游戏。游戏一共有 mmm 轮,Alice手里有一个长度为 nnn 的序列 aaa ;和常数 KKK ,每一轮游戏,Alice会从序列中取出一个连续区间 [Li,Ri][L_i,R_i][Li,Ri] 给Bob,问Bob这个区间中存在多少个连续子区间满足,区间中不同的数的个数不小于 KKK 。Bob全部回答正确了则Bob赢,否则是Alice赢。现在你需要帮助Bob赢得游戏。Input第一行,三个正整数 n,m,Kn,m,Kn,m,K (1≤n,m,K≤105)(1≤n,原创 2021-05-25 15:20:07 · 859 阅读 · 0 评论 -
P3402 可持久化并查集
题目链接题目描述给定 nnn 个集合,第 iii 个集合内初始状态下只有一个数,为 iii 。有 mmm 次操作。操作分为 333 种:1 a b 合并 a,ba,ba,b 所在集合;2 k 回到第 kkk 次操作(执行三种操作中的任意一种都记为一次操作)之后的状态;3 a b 询问 a,ba,ba,b 是否属于同一集合,如果是则输出 111 ,否则输出 000 。输入格式第一行两个整数,n,mn,mn,m 。接下来 mmm 行,每行先输入一个数 optoptopt 。若 opt=2opt原创 2021-05-02 21:02:25 · 132 阅读 · 0 评论 -
Codeforces Round #716 (Div. 2) D. Cut and Stick
题目链接Baby Ehab has a piece of Cut and Stick with an array aaa of length nnn written on it. He plans to grab a pair of scissors and do the following to it:pick a range (l,r)(l, r)(l,r) and cut out every element ala_lal, al+1a_{l + 1}al+1, …, ara_rar in原创 2021-04-26 20:23:52 · 183 阅读 · 0 评论 -
2021ICPC昆明 M.Stone Games
题目链接题目描述There are nnn piles of stones, the iii-th of which contains sis_isi stones. The tiles are numbered from 111 to nnn. Rika and Satoko are playing a game on it.During each round of the game, Rika chooses some piles from all nnn piles. Let denote t原创 2021-04-05 22:47:41 · 2033 阅读 · 4 评论 -
2019 ICPC南昌邀请赛 J Distance on the tree
题目链接A tree with nnn nodes, which is numbered from 111 to nnn. Edge between each two adjacent vertexes uuu and vvv has a value www, you’re asked to answer the number of edge whose value is no more than kkk during the path between uuu and vvv.InputIn the原创 2020-11-05 21:18:36 · 230 阅读 · 0 评论 -
Codeforces Round #668 (Div. 2)E. Fixed Point Removal
Let a1,…,ana_1,\dots,a_na1,…,an be an array of nnn positive integers. In one operation, you can choose an index iii such that ai=ia_i=iai=i, and remove aia_iai from the array (after the removal, the remaining parts are concatenated).The weight of aaa原创 2020-09-08 19:59:53 · 223 阅读 · 0 评论 -
P4137 Rmq Problem / mex
题目链接题目描述有一个长度为 nnn 的数组 {a1,a2,…,an}\{a_1,a_2,\ldots,a_n\}{a1,a2,…,an}。mmm 次询问,每次询问一个区间内最小没有出现过的自然数。输入格式第一行 n,mn,mn,m。第二行为 nnn 个数。从第三行开始,每行一个询问 l,rl,rl,r。输出格式一行一个数,表示每个询问的答案。输入输出样例输入 #15 52 1 0 2 13 32 32 41 23 5输出 #112303说明/提示原创 2020-08-30 14:33:40 · 136 阅读 · 0 评论 -
Interval
链接:https://ac.nowcoder.com/acm/contest/5670/H来源:牛客网题目描述Mr. W have a sequence AAA with length NNN.F(l,r)=Al&Al+1&...&ArF(l,r) = A_l\&A_{l+1}\&...\&A_rF(l,r)=Al&Al+1&...&ArSet S(l,r)={F(a,b) ∣min(l,r)≤a≤b≤max(原创 2020-08-05 11:06:18 · 247 阅读 · 0 评论
分享