
其他DP
文章平均质量分 68
Mr_Treeeee
这个作者很懒,什么都没留下…
展开
-
HDU 6035 Colorful Tree(树形DP)
Colorful TreeTime Limit: 6000/3000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 1903 Accepted Submission(s): 804Problem DescriptionThere is a原创 2017-07-29 17:02:35 · 348 阅读 · 0 评论 -
Codeforces Round #459 (Div. 2) - D. MADMAX (记忆化搜索)
http://codeforces.com/contest/918/problem/D题意:在一个DAG图上,每条边都有一个权值,A先走,B后走。每次走的时候,当前走的边的权值不能小于上次(A或者B都算)走的。无路可走则输。输出每一种可能的答案。POINT:dp[200][110][110];//前一条边值、【当前】先走的人所在的顶点、【当前】后原创 2018-01-31 14:33:51 · 314 阅读 · 0 评论 -
POJ 3417 - Network (LCA+DP)
NetworkTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 5627 Accepted: 1595DescriptionYixght is a manager of the company called SzqNetwork(SN). Now she's very worried because she has just rec...原创 2018-03-25 10:50:14 · 210 阅读 · 0 评论 -
ZOJ 3802 - Easy 2048 Again (状态压缩DP+滚动数组)
Easy 2048 AgainTime Limit: 2 Seconds Memory Limit: 65536 KBDark_sun knows that on a single-track road (which means once he passed this area, he cannot come back again), there are some underground...原创 2018-04-18 10:02:46 · 204 阅读 · 0 评论 -
第六届福建省赛 - G - Simple String Problem (状压DP)
题目题意:给你n长的字符串,是由前k个字母组成的。问你挑出两个子串,他们不能拥有相同的字母。问你len(串a)*len(串b)最大是多少。POINT:状压。考虑串长度只有2000。可以用2000*2000的效率算出每个状态最大的长度是多少。然后如果枚举每个状态再和其他状态相比较得出答案,效率是(1<<k)*(1<<k)。显然是不行的所以预处理出dp[i],代表i这个状态和他...原创 2018-05-09 16:01:40 · 337 阅读 · 2 评论 -
“浪潮杯”山东省第七届ACM大学生程序设计竞赛 - Feed the monkey(记忆化搜索)
链接题意:给你3种水果的数量,和水果分别连续吃的最大天数。问你猴子吃水果有多少种方案。POINT:记忆化搜索,一开始(pre=-1)可以吃3种水果,然后换着吃搜就好了。搜到0 0 0肯定是1。搜到只剩下一种水果了,那就要看看能不能一次吃光了。因为可以剩下的水果会大于 最大连续天数。dp初始化不能为0,可以-1,然后剪枝。因为答案为0的情况挺多的。所以-1比较好,不会超时。我另开了vis数组。#in...原创 2018-05-05 08:45:37 · 411 阅读 · 0 评论 -
AtCoder Regular Contest 097 - E - Sorted and Sorted (逆序对)
点击打开链接题意:给你黑白两种1-n编号的球。让你交换相邻的球,让黑i在黑i+1的上面。百i在白i+1的上面。POINT:dp[x][y]代表排好了白1-x和黑1-y 编号的球。dp[x][y]从dp[x-1][y]或dp[x][y-1]推出来。用树状数组算出逆序对。#include<iostream>#include<stdio.h>#include<algor...原创 2018-05-30 21:50:29 · 438 阅读 · 0 评论 -
2018 Multi-University Training Contest 5 - Hills And Valleys (DP)
http://acm.hdu.edu.cn/showproblem.php?pid=6357 题意:你可以任意反转一个区间,问你之后可以得到的最长不递减子序列是多长。 优秀的题解 #include <iostream>#include <stdio.h>using namespace std;const int maxn = 1e5...原创 2018-08-09 09:57:37 · 209 阅读 · 0 评论 -
ZOJ 3755 - Mines (状压DP)
http://acm.zju.edu.cn/onlinejudge/showProblem.do?problemId=5178题意:大家都玩过扫雷吧。给你n*m的扫雷数字。数字都在偶数列上。也就是说,棋盘是n*(2*m+1)大小。让你输出最少的雷数。 POINT:n最大是10,暗示我们状压DP。挺简单的,不阐述了。#include <stdio.h&...原创 2018-09-27 22:15:58 · 291 阅读 · 0 评论 -
牛客国庆集训派对Day3 - B Tree (树形DP)
https://www.nowcoder.com/acm/contest/203/B 题解 思路差不多,不过没用那个flag。如果碰到dp[u]+1 % mod ==0的时候。直接重新搜一遍。#include <vector>#include <stdio.h>#include <iostream>#include <st...原创 2018-10-07 18:54:19 · 319 阅读 · 0 评论 -
Codeforces Round #513 - E. Sergey and Subway (树形DP)
http://codeforces.com/contest/1060/problem/E题意:问你一棵树上的所有点与点之间的距离。不过可以2步当成1步走。(跳着走)(即如果两个点隔了一个点,就连一条边)POINT:首先,如果距离为偶数,直接除2,如果距离为奇数,除2+1。 算出所有点与点之间的距离(不跳的真实距离)。树形DP解决。可以算每条边被走了几次,边(u,...原创 2018-10-07 19:51:08 · 443 阅读 · 0 评论 -
ACdream 1028 - Path (树形DP)
PathTime Limit: 4000/2000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others)Submit Statistic Next ProblemProblem DescriptionCheck if there exists a path of length l in the原创 2017-12-05 22:49:20 · 274 阅读 · 0 评论 -
AtCoder Beginner Contest 082 - D - FT Robot (set||DP)
D - FT RobotTime limit : 2sec / Memory limit : 512MBScore : 500 pointsProblem StatementA robot is put at the origin in a two-dimensional plane. Initially, the robot is facing in th原创 2017-12-22 21:23:19 · 569 阅读 · 0 评论 -
HDU 1565 方格取数(1) (状压DP)
方格取数(1)Time Limit: 10000/5000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 9419 Accepted Submission(s): 3564Problem Description给你一个n*n的格子的棋盘,每个格原创 2017-08-17 23:06:19 · 319 阅读 · 0 评论 -
HDU 1074 Doing Homework(状压DP)
Doing HomeworkTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 9486 Accepted Submission(s): 4481Problem DescriptionIgnatius ha原创 2017-07-17 15:58:06 · 275 阅读 · 0 评论 -
HDU 1231 最大连续子序列 (DP)
最大连续子序列Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 32448 Accepted Submission(s): 14552Problem Description给定K个整数的序列{ N1, N原创 2017-05-21 14:04:28 · 433 阅读 · 0 评论 -
HDU 1284 钱币兑换问题 (法一:计数DP 法二:普通)
钱币兑换问题Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 10390 Accepted Submission(s): 6324Problem Description在一个国家仅有1分,2分,3分硬币,原创 2017-05-13 23:28:57 · 423 阅读 · 0 评论 -
FZU 2129 子序列个数(计数DP)
Problem 2129 子序列个数Accept: 282 Submit: 920Time Limit: 2000 mSec Memory Limit : 32768 KB Problem Description子序列的定义:对于一个序列a=a[1],a[2],......a[n]。则非空序列a'=a[p1],a[p2]......a[pm]为a的一个子原创 2017-05-13 15:27:33 · 422 阅读 · 0 评论 -
ZUFE 1120 trs滑雪(记忆化搜索)
1120: trs滑雪时间限制: 1 Sec 内存限制: 128 MB提交: 63 解决: 22[提交][状态][讨论版]题目描述 trs喜欢滑雪。他来到了一个滑雪场,这个滑雪场是一个矩形,为了简便,我们用r行c列的矩阵来表示每块地形。为了得到更快的速度,滑行的路线必须向下倾斜。 例如样例中的那个矩形,可以从某个点滑向上下左右四个相邻的原创 2017-05-09 17:45:18 · 613 阅读 · 0 评论 -
HDU1142 A Walk Through the Forest(SPFA+记忆化搜索)
A Walk Through the ForestTime Limit : 2000/1000ms (Java/Other) Memory Limit : 65536/32768K (Java/Other)Total Submission(s) : 32 Accepted Submission(s) : 12Font: Times New Roman | Verda原创 2017-05-02 21:26:54 · 396 阅读 · 0 评论 -
HDU 1003 Max Sum && HDU 1081 To The Max 一维子串最大和& 二维矩阵最大和
Max SumTime Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 253528 Accepted Submission(s): 60167Problem DescriptionGiven a sequenc原创 2017-08-14 22:59:33 · 380 阅读 · 0 评论 -
POJ 3254 - Corn Fields (状压DP)
Corn FieldsTime Limit: 2000MS Memory Limit: 65536KTotal Submissions: 17014 Accepted: 8987DescriptionFarmer John has purchased a lush new rectangular pasture compo原创 2017-11-21 22:02:52 · 249 阅读 · 0 评论 -
ACdream 1015 - Double Kings (记忆化搜索)
Double KingsTime Limit: 2000/1000MS (Java/Others) Memory Limit: 128000/64000KB (Java/Others)Submit Statistic Next ProblemProblem DescriptionOur country is tree-like structure, that i原创 2017-12-05 22:43:14 · 303 阅读 · 0 评论 -
牛客国庆集训派对Day6 - E Growth (DP+离散化)
https://www.nowcoder.com/acm/contest/206/EPOINT:主要还是离散化,然后map里存,(x,y)这里属性里可以获得多少Z。add[x][y]代表刚刚到了x,y后,每天可以获得多少z。DP[x][y]代表刚刚到了x,y后,最多总共获得了多少z。 #include<stdio.h>#include<iostream...原创 2018-10-15 17:38:54 · 343 阅读 · 0 评论