随笔分类 - 数据结构 - 树状数组
摘要:链接:https://ac.nowcoder.com/acm/contest/308/D来源:牛客网 题目描述 tokitsukaze给你一个长度为n的序列,这个序列是1到n的一种排列。 然后她会进行q次操作。每次操作会给你L R k这三个数,表示区间[L,R]往右移动k次。 移动一次的定义是:一个
阅读全文
摘要:题目链接 Problem StatementWe will define the median of a sequence b of length M, as follows: Let b' be the sequence obtained by sorting b in non-decreasin
阅读全文
摘要:链接:https://www.nowcoder.com/acm/contest/143/F来源:牛客网 题目描述 Kanade has n boxes , the i-th box has p[i] probability to have an diamond of d[i] size. At th
阅读全文
摘要:链接:https://www.nowcoder.com/acm/contest/139/J来源:牛客网题目描述Given a sequence of integers a1, a2, ..., an and q pairs of integers (l1, r1), (l2, r2), ..., (
阅读全文
摘要:链接:https://www.nowcoder.com/acm/contest/112/D来源:牛客网 题目描述 一个只含数字的字符串,q次操作,每次操作将第i位数字改为x,每次操作后,统计长度在[l, r]之间且首数字大于尾数字的子串的个数。 输入描述: 第一行一个只含数字的字符串;第二行3个整数
阅读全文
摘要:You are given a tree, it’s root is p, and the node is numbered from 1 to n. Now define f(i) as the number of nodes whose number is less than i in all
阅读全文
摘要:One day Polycarp decided to rewatch his absolute favourite episode of well-known TV series "Tufurama". He was pretty surprised when he got results onl
阅读全文
摘要:Given an N*N matrix A, whose elements are either 0 or 1. A[i, j] means the number in the i-th row and j-th column. Initially we have A[i, j] = 0 (1 <=
阅读全文
摘要:推荐博客 :https://blog.csdn.net/wconvey/article/details/7827188 在第二遍看了树状数组后, 感觉有了更深的认识,既然是树状数组,从名字来看,就是像树的一个数组,没错,就是一个普通的数组,我们把他假定成为一棵树。 用 C1 表示 A1 的和 用 C
阅读全文
摘要:推荐博客 : https://www.cnblogs.com/RabbitHu/p/BIT.html https://www.cnblogs.com/lcf-2000/p/5866170.html 树状数组的作用 : 修改某点的值 , 查询某段区间的和 , 这是树状数组的强项 。其区间查询的和 为
阅读全文