随笔分类 -  线段树

摘要:题目链接:https://vjudge.net/problem/CodeForces-833B 题意:给长度为n的数组a,和一个整数k要求把数组分成连续的k段,每段的权值是该段中不同数的个数,输出最大权值和。数据范围:n<=35000,k<=min(n,50),1<=a(i)<=n 题解:很容易想到 阅读全文
posted @ 2020-11-14 17:11 kongbursi 阅读(80) 评论(0) 推荐(0) 编辑
摘要:题意:给你一个长度为n的数组v,你需要把这个数组分成很多段,你需要保证每一段的长度不能超过k我们设一共有m段,每一段右边界那个数为bi那么我们要使得sum(bi*bi-b(i-1))最大 (1<=i<=m,b0=0)你需要保证bi>b(i-1) (1<=i<=m)sum():表示求和 题解:我们设数 阅读全文
posted @ 2020-11-14 17:07 kongbursi 阅读(53) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2019-05-24 00:23 kongbursi 阅读(133) 评论(0) 推荐(0) 编辑
摘要:小A的楼房外有一大片施工工地,工地上有N栋待建的楼房。每天,这片工地上的房子拆了又建、建了又拆。他经常无聊地看着窗外发呆,数自己能够看到多少栋房子。 为了简化问题,我们考虑这些事件发生在一个二维平面上。小A在平面上(0,0)点的位置,第i栋楼房可以用一条连接(i,0)和(i,Hi)的线段表示,其中H 阅读全文
posted @ 2019-05-23 23:34 kongbursi 阅读(154) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2019-05-23 23:02 kongbursi 阅读(103) 评论(0) 推荐(0) 编辑
摘要: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 阅读全文
posted @ 2019-05-23 22:51 kongbursi 阅读(97) 评论(0) 推荐(1) 编辑

点击右上角即可分享
微信分享提示