
动态规划/递推
BUAA_Alchemist
这个作者很懒,什么都没留下…
展开
-
【矩阵快速幂】【状态压缩】【动态规划】lydsy4000 [TJOI2015]棋盘
4000: [TJOI2015]棋盘Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 643 Solved: 314[Submit][Status][Discuss]DescriptionInput输入数据的第一行为两个整数N,M表示棋盘大小。第二行为两个整数P,K,表示攻击范围模板的大小,以及棋子在模板中的位置。接下来三行,每行P个...原创 2018-12-05 23:07:39 · 255 阅读 · 0 评论 -
【贪心】【动态规划】【数学思维】codeforces1152D Neko and Aki's Prank
D. Neko and Aki’s Pranktime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard outputNeko is playing with his toys on the backyard of Aki’s house. Aki decid...原创 2019-04-25 15:25:14 · 1113 阅读 · 0 评论 -
【动态规划】codeforces1149B Three Religions
B. Three Religionstime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputDuring the archaeological research in the Middle East you found the traces ...原创 2019-04-30 11:45:52 · 541 阅读 · 0 评论 -
【动态规划】codeforces1155D Beautiful Array
D. Beautiful Arraytime limit per test2 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given an array a consisting of n integers. Beauty of array is the m...原创 2019-04-24 16:40:31 · 359 阅读 · 0 评论 -
【数学思维】【动态规划】codeforces1153F Serval and Bonus Problem
Getting closer and closer to a mathematician, Serval becomes a university student on math major in Japari University. On the Calculus class, his teacher taught him how to calculate the expected length...原创 2019-04-15 16:12:03 · 378 阅读 · 0 评论 -
【动态规划】北航程序设计竞赛决赛B题
决赛那天感觉确实没发挥好。本来有机会逃离三题大队的。结果中途很多人搞了几何构造题,忍不住跟风。事实证明以我的想象力果然搞不出来。还不如专心搞搞B这题。 B的题意很简单,给一个长度不超过5000的字符串,字符集大小不超过5000,求字典序第k小的子串(子串可以不连续),k规模不超过子串总数以及1E18。 先考虑每个字符都不同的情况,很容易想到一个一个把答案的字符定下来。我们每一次求出下一步接字...原创 2019-03-29 00:11:38 · 611 阅读 · 0 评论 -
【递推】codeforces1140E Palindrome-less Arrays
1140E Palindrome-less ArraysLet’s denote that some array b is bad if it contains a subarray bl,bl+1,…,br of odd length more than 1 (l<r and r−l+1 is odd) such that ∀i∈{0,1,…,r−l} bl+i=br−i.If an ...原创 2019-04-05 22:52:57 · 295 阅读 · 0 评论 -
【动态规划】Stacking Plates
传送门:http://lx.lanqiao.cn/problem.page?gpid=T507问题描述 盘子装运公司是一家网络零售商,顾名思义,是一家只销售盘子的公司。该公司销售的盘子由不计其数的生产厂商提供,品种是全宇宙最多的,为此公司的员工倍感自豪。 在最近的一次成本分析中,公司员工发现,他们花费了大量金钱在盘子的装箱环节。一部分原因是盘子在被运输工具运走前,需要被堆成一堆。很显然...原创 2019-02-10 21:27:28 · 1312 阅读 · 0 评论 -
【二分答案】【动态规划】【扫描线】人以群分
传送门:https://nanti.jisuanke.com/t/36107某班有 n 个同学,每个同学有一个外向程度 ai 。由于要进行某个活动,需要把他们分成若干个小组,每个小组的人数至少为 m 人。不同外向程度的人在一个小组会产生不开心值,定义一个小组的不开心值为组内成员外向程度最大值和最小值的差,一个班级的不开心值为所有小组不开心值的最大值。那么问题来了,如何分组使得班级的不开...原创 2019-02-10 09:23:43 · 1111 阅读 · 7 评论 -
【动态规划】【四边形不等式】合并石子
传送门:http://lx.lanqiao.cn/detail.page?submitid=3262677问题描述 在一条直线上有n堆石子,每堆有一定的数量,每次可以将两堆相邻的石子合并,合并后放在两堆的中间位置,合并的费用为两堆石子的总数。求把所有石子合并成一堆的最小花费。输入格式 输入第一行包含一个整数n,表示石子的堆数。 接下来一行,包含n个整数,按顺序给出每堆石子的大小 ...原创 2019-02-15 19:03:58 · 402 阅读 · 0 评论 -
【动态规划】【树的dfs】【LCA】codeforces1111E Tree
E. Treetime limit per test1.5 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputYou are given a tree with n nodes and q queries.Every query starts with three integ...原创 2019-02-05 14:40:07 · 538 阅读 · 0 评论 -
【动态规划】【数学思维】codeforces1111D Destroy the Colony
D. Destroy the Colonytime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputThere is a colony of villains with several holes aligned in a row, where...原创 2019-02-04 12:11:18 · 886 阅读 · 0 评论 -
【动态规划】【预处理】codeforces1106E Lunar New Year and Red Envelopes
E. Lunar New Year and Red Envelopestime limit per test3 secondsmemory limit per test256 megabytesinputstandard inputoutputstandard outputLunar New Year is approaching, and Bob is going to receive...原创 2019-02-01 22:49:19 · 576 阅读 · 0 评论 -
【动态规划】【倒序】codeforces102056I Misunderstood … Missing
I. Misunderstood … Missingtime limit per test1.0 smemory limit per test256 MBinputstandard inputoutputstandard outputWarm sunshine, cool wind and a fine day, while the girl watching is pursuing i...原创 2019-01-25 21:55:25 · 667 阅读 · 0 评论 -
【动态规划】【容斥原理】atcoder.jp/contests/dp/tasks/dp_y Grid 2
题目链接:https://atcoder.jp/contests/dp/tasks/dp_y 这题思维难度中等,但似乎是一道很经典的题目,所以记录一下。 假如H或者W不是那么大的话,直接开一个H*W的数组慢慢dp就行了。这里H和W比较大,但是N比较小,看数据范围就知道可能是做一个N2N^2N2级别的dp。 在图中,如果左上右下两点之间没有阻碍,那么路线数目就是组合数Cy2−y1+x2−x...原创 2019-01-15 13:34:51 · 975 阅读 · 0 评论 -
【动态规划】lydsy4498 魔法的碰撞 lydsy4664 Count 特殊的序列dp方法
这是我没有接触过的dp类型。因此记录一下。 先看lydsy4498(这题现在OJ上已经消失了)。 首先容易想到,对于一个布阵方式,我们可以把多余的格子抽掉,还原出一个魔法师紧凑的局面。那么每一个魔法师紧凑的局面,如果长度为lll,往其中填充L−lL-lL−l个格子,通过插板原理,我们知道它对应着Cn+L−lnC_{n+L-l}^nCn+L−ln个布阵,于是问题转化为求长度为lll的紧凑局面...原创 2019-05-11 12:00:43 · 327 阅读 · 0 评论