
动态规划
文章平均质量分 70
lifelikes
这个作者很懒,什么都没留下…
展开
-
牛客练习赛14 B 区间连续段 倍增st表
链接:https://www.nowcoder.com/acm/contest/82/B 来源:牛客网时间限制:C/C++ 7秒,其他语言14秒 空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %lld 题目描述给你一个长为n的序列a和一个常数k有m次询问,每次查询一个区间[l,r]内所有数最少分成多少个连续段,使得每段的和都 &...原创 2018-03-31 22:11:35 · 354 阅读 · 0 评论 -
2017-2018 ACM-ICPC, Asia Tsukuba Regional Contest B - Parallel Lines
PS: 这是一道签到题, RB强者 恐怖如斯。 Given an even number of distinct planar points, consider coupling all of the points into pairs. All the possible couplings are to be considered as long as all the given points...原创 2018-10-19 17:01:18 · 505 阅读 · 0 评论 -
codeforces856 B Similar Words 模型转换 tree图建图+树形dp
B. Similar Wordstime limit per test2 secondsmemory limit per test512 megabytesinputstandard inputoutputstandard outputLet us call a non-empty sequence of lowercase English letters a word. Prefix ...原创 2018-10-04 20:40:16 · 226 阅读 · 0 评论 -
Educational Codeforces Round 46 G. Two-Paths 树形DP 树上两点路径长度变形。
点我看题题意 : 给出一颗树,每条边有过路费,每个点有价值 定义一种名叫tow-path的路径 这种路径上 每条边可以经过最多两次 路径的权值为: 既路径上所有经过的点的权值和减去过路费之和; 现在有q次询问 每次询问给出两个点u,v 。 对于每次询问 要求输出u到v的tow-path 最大权值。解题思路: 首先,看见这题应该要联想到 求树上两点路径长度 这一经典问题...原创 2018-07-26 19:59:12 · 362 阅读 · 0 评论 -
牛客网暑期ACM多校训练营(第一场) E Removal dp递推
时间限制:C/C++ 2秒,其他语言4秒空间限制:C/C++ 524288K,其他语言1048576K 64bit IO Format: %lld题目描述Bobo has a sequence of integers s1, s2, …, sn where 1 ≤ si ≤ k. Find out the number of distinct sequences m...原创 2018-07-20 21:05:34 · 288 阅读 · 0 评论 -
牛客网暑期ACM多校训练营(第一场) B Symmetric Matrix
时间限制:C/C++ 1秒,其他语言2秒空间限制:C/C++ 524288K,其他语言1048576K 64bit IO Format: %lld题目描述Count the number of n x n matrices A satisfying the following condition modulo m. * Ai, j ∈ {0, 1, 2} for all...原创 2018-07-19 22:23:16 · 493 阅读 · 2 评论 -
Codeforces Round #495 (Div. 2) E. Sonya and Ice Cream 树形DP 找树直径
E. Sonya and Ice Cream time limit per test2 seconds memory limit per test256 megabytes inputstandard input outputstandard output Sonya likes ice cream very much. She eats it even during programmi...原创 2018-07-25 09:16:55 · 276 阅读 · 0 评论 -
牛客网暑期ACM多校训练营(第二场) H travel 树形DP
时间限制:C/C++ 2秒,其他语言4秒空间限制:C/C++ 262144K,其他语言524288K 64bit IO Format: %lld题目描述White Cloud has a tree with n nodes.The root is a node with number 1. Each node has a value. White Rabbit wa...原创 2018-07-23 10:58:10 · 361 阅读 · 0 评论 -
ZOJ 4031 Game on a Tree 树形DP
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5772BaoBao is playing a game on a rooted tree with vertices and weighted edges. At the beginning of the game, a chess piece is placed on ...原创 2018-05-08 09:20:45 · 1519 阅读 · 2 评论 -
山东农业大学校赛 H wyh的吃鸡 最短路 dij
链接:https://www.nowcoder.com/acm/contest/93/H 来源:牛客网题目描述最近吃鸡游戏非常火,你们wyh学长也在玩这款游戏,这款游戏有一个非常重要的过程,就是要跑到安全区内,否则就会中毒持续消耗血量,我们这个问题简化如下假设地图为n*n的一个图,图中有且仅有一块X的联通快代表安全区域,有一个起点S代表缩圈的时候的起点,图中C代表的是车(保证车的数量...原创 2018-04-05 20:04:35 · 452 阅读 · 0 评论 -
CSUoj 2020 Card Hand Sorting 最长递增序列 暴力枚举
DescriptionWhen dealt cards in the card game Plump it is a good idea to start by sorting the cards in hand by suit and rank. The different suits should be grouped and the ranks should be sorted with...原创 2018-04-03 20:52:54 · 282 阅读 · 0 评论 -
Educational Codeforces Round 40 (Rated for Div. 2) F. Runner's Problem 前缀和求区间覆盖 矩阵快速幂优化DP 离散化
题目链接 You are running through a rectangular field. This field can be represented as a matrix with 3 rows and m columns. (i, j) denotes a cell belonging to i-th row and j-th column.You start in (2, 1...原创 2018-03-26 16:26:30 · 291 阅读 · 0 评论 -
SWERC 2017 D - Candy Chain 字典树优化区间DP
D: Candy ChainA Candy Chain is a sequence of individual candies. Candies come in 26 different flavors identified bythe lowercase letters a to z. Margot has a particularly fancy Candy Chain displayed...原创 2018-10-22 22:19:25 · 542 阅读 · 1 评论