随笔分类 - 线段树
摘要:题目链接:https://vjudge.net/problem/CodeForces-833B 题意:给长度为n的数组a,和一个整数k要求把数组分成连续的k段,每段的权值是该段中不同数的个数,输出最大权值和。数据范围:n<=35000,k<=min(n,50),1<=a(i)<=n 题解:很容易想到
阅读全文
摘要:题意:给你一个长度为n的数组v,你需要把这个数组分成很多段,你需要保证每一段的长度不能超过k我们设一共有m段,每一段右边界那个数为bi那么我们要使得sum(bi*bi-b(i-1))最大 (1<=i<=m,b0=0)你需要保证bi>b(i-1) (1<=i<=m)sum():表示求和 题解:我们设数
阅读全文
摘要:Japan plans to welcome the ACM ICPC World Finals and a lot of roads must be built for the venue. Japan is tall island with N cities on the East coast
阅读全文
摘要:小A的楼房外有一大片施工工地,工地上有N栋待建的楼房。每天,这片工地上的房子拆了又建、建了又拆。他经常无聊地看着窗外发呆,数自己能够看到多少栋房子。 为了简化问题,我们考虑这些事件发生在一个二维平面上。小A在平面上(0,0)点的位置,第i栋楼房可以用一条连接(i,0)和(i,Hi)的线段表示,其中H
阅读全文
摘要:Painting some colored segments on a line, some previously painted segments may be covered by some the subsequent ones. Your task is counting the segme
阅读全文
摘要:The citizens of Bytetown, AB, could not stand that the candidates in the mayoral election campaign have been placing their electoral posters at all pl
阅读全文