树状数组
文章平均质量分 87
树状数组
_sky123_
这个作者很懒,什么都没留下…
展开
-
Harbour.Space Scholarship Contest 2021-2022 F. Pairwise Modulo
题目链接You have an array aaa consisting of nnn distinct positive integers, numbered from 111 to nnn. Define pkp_kpk as pk=∑1≤i,j≤kai mod aj,p_k = \sum_{1 \le i, j \le k} a_i \bmod a_j,pk=1≤i,j≤k∑aimodaj, where x mod yx \bmod yxmody denotes the remainder原创 2021-07-26 23:21:36 · 129 阅读 · 0 评论 -
牛客练习赛80 E.覆盖
题目链接题目描述给出 nnn 条线段 [l1,r1],…,[ln,rn][l_1,r_1],…,[l_n,r_n][l1,r1],…,[ln,rn] ,qqq 次询问编号在 [a,b][a,b][a,b] 内的线段覆盖的总长度是多少。线段覆盖的总长度定义为:在一条无限长的数轴上有多少整点,使得该整点至少被一条线段覆盖到。输入描述:第一行两个整数 n,qn,qn,q ;接下来 nnn 行每行两个整数 li,ril_i,r_ili,ri ,表示一条线段;接下来 qqq 行每行两个整数原创 2021-04-13 00:16:52 · 175 阅读 · 0 评论 -
Codeforces Global Round 13 E. Fib-tree
题目链接Let FkF_kFk denote the kkk-th term of Fibonacci sequence, defined as below:F0=F1=1F_0 = F_1 = 1F0=F1=1for any integer n≥0n \geq 0n≥0, Fn+2=Fn+1+FnF_{n+2} = F_{n+1} + F_nFn+2=Fn+1+FnYou are given a tree with nnn vertices. Recall that a tree原创 2021-03-02 16:05:49 · 214 阅读 · 0 评论 -
Educational Codeforces Round 85 (Rated for Div. 2) F. Strange Function
题目链接Let’s denote the following function fff. This function takes an array aaa of length nnn and returns an array. Initially the result is an empty array. For each integer iii from 111 to nnn we add element aia_iai to the end of the resulting array if it原创 2021-02-24 23:56:47 · 148 阅读 · 0 评论 -
2020CCPC威海 H. Message Bomb
题目链接While we enjoy chatting with friends on the internet, it is always annoying that we are overwhelmed by lots of messages in various chat groups. A great majority of these messages are actually not interesting to us, but we may miss some important notic原创 2020-12-18 09:58:20 · 225 阅读 · 0 评论 -
Divide Square
There is a square of size 106×10610^6×10^6106×106 on the coordinate plane with four points (0,0)(0,0)(0,0), (0,106)(0,10^6)(0,106), (106,0)(10^6,0)(106,0), and (106,106)(10^6,10^6)(106,106) as its vertices.You are going to draw segments on the plane. All原创 2020-08-23 11:21:13 · 225 阅读 · 0 评论 -
Two Types of Spells
Polycarp plays a computer game (yet again). In this game, he fights monsters using magic spells.There are two types of spells: fire spell of power xxx deals xxx damage to the monster, and lightning spell of power yyy deals yyy damage to the monster and do原创 2020-08-16 18:15:03 · 237 阅读 · 0 评论 -
Educational Codeforces Round 80 (Rated for Div. 2) E. Messenger Simulator
Polycarp is a frequent user of the very popular messenger. He’s chatting with his friends all the time. He has nnn friends, numbered from 111 to nnn.Recall that a permutation of size nnn is an array of size nnn such that each integer from 111 to nnn occur原创 2020-05-23 00:06:18 · 288 阅读 · 0 评论 -
Rotating Cards
A magician has a stack of n cards labeled 1 through n, in random order. Her trick involves discarding all of the cards in numerical order (first the card labeled 1, then the card labeled 2, etc.). U...原创 2020-04-06 22:35:19 · 190 阅读 · 0 评论 -
CF1354D Multiset
Note that the memory limit is unusual.You are given a multiset consisting of n integers. You have to process queries of two types:add integer k into the multiset;find the k-th order statistics in the multiset and remove it.k-th order statistics in the原创 2020-05-19 06:57:17 · 300 阅读 · 0 评论