随笔分类 - 4. 动态规划dp
摘要:The Bookcase https://odzkskevi.qnssl.com/31465a17250189570dad37924cda0d26?v=1508622471 【题解】 。。。紫书上第二个优化不可信啊!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! 去了第二个优化写
阅读全文
摘要:Fun Game https://odzkskevi.qnssl.com/8d698323a1e07d605cdeea708ee8a01d?v=1508703139 【题解】 不难发现如果一个串的原串或反转串是另一个串的子串,那么这个串是没有用的 我们把他剔除出去 如果此时只有一个串,暴力枚举解检查
阅读全文
摘要:Bigger is Better https://odzkskevi.qnssl.com/91b457ef612009fbd8a70f1852aad0cc?v=1508483406 【题解】 dp[i][j]表示前i位数mod m = j的最小火柴数 据此找到位数i,从高位开始枚举做即可 需要与处理
阅读全文
摘要:Fixing the Great Wall https://odzkskevi.qnssl.com/b7d37f69f479d57e44735fc5d6403983?v=1508326275 【题解】 按照x排序 dp[i][j][0/1]表示从i到j全修好,当前在i/j的最小代价和已知的未修好的时
阅读全文
摘要:Dropping water balloons https://odzkskevi.qnssl.com/0876833faf9646139e4e75ecade141db?v=1508497019 【题解】 太神辣。。。 dp[i][j]表示用i个气球,j次试验所测试的楼的最大高度 当我们已知dp[1
阅读全文
摘要:Team them up! https://odzkskevi.qnssl.com/9698e76abf2d161889085123803f9464?v=1508663873 【题解】 把“两个人不相互认识”连边,形成若干连通分量 不难发现每个联通分量进行黑白染色后,必定选黑或选白 DP[i][j]
阅读全文
摘要:Twenty Questions https://odzkskevi.qnssl.com/15b7eb4cd1f75f63cee3945b0b845e4f?v=1508411736 【题解】 dp[S1][S2]表示已经询问了S1,确定有S2,还需要至少多少次询问 dp[S1][S2] = max(
阅读全文
摘要:D. Robot Control time limit per test 6 seconds memory limit per test 256 megabytes input standard input output standard output The boss of the Company
阅读全文
摘要:https://odzkskevi.qnssl.com/b506a3c20adad78678917d1ff4c9b953?v=1508327485 【题解】 dp[i][S1][S2]表示前i个教师选/不选已经决策完,当前有一个老师教的课程为S1,两个老师教的课程为S2,还需要的最小价值 答案为dp
阅读全文
摘要:Another Crisis A couple of years ago, a new world wide crisis started, leaving many people with economical problems. Some workers of a particular comp
阅读全文
摘要:https://odzkskevi.qnssl.com/e17d84412b7ea3a42b6503109d6dfbc1?v=1508053531 【题解】 裸区间dp,注意一堆细节 1 #include <iostream> 2 #include <cstdio> 3 #include <algo
阅读全文
摘要:https://vjudge.net/problem/UVA-1625 【题解】 很有思维难度的一道题 http://www.cnblogs.com/zyb993963526/p/6364069.html 1 #include <iostream> 2 #include <cstdio> 3 #in
阅读全文
摘要:Partitioning by Palindromes We say a sequence of characters is a palindrome if it is the same written forwards and backwards. For example, ‘racecar’ i
阅读全文
摘要:You are given the task to design a lighting system for a huge conference hall. After doing a lot of calculation and sketching, you have figured out th
阅读全文
摘要:(If you smiled when you see the title, this problem is for you ^_^) For those who don’t know KTV, see: http://en.wikipedia.org/wiki/Karaoke_box There
阅读全文
摘要:https://odzkskevi.qnssl.com/292ca2c84ab5bd27a2a91d66827dd320?v=1508162936 https://vjudge.net/problem/UVA-116 Problems that require minimum paths throu
阅读全文
摘要:不要62 Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 46770 Accepted Submission(s): 17751 Problem
阅读全文
摘要:John Doe, a skilled pilot, enjoys traveling. While on vacation, he rents a small plane and starts visiting beautiful places. To save money, John must
阅读全文
摘要:1924: [Sdoi2010]所驼门王的宝藏 Description Input 第 一行给出三个正整数 N, R, C。 以下 N 行,每行给出一扇传送门的信息,包含三个正整数xi, yi, Ti,表示该传送门设在位于第 xi行第yi列的藏宝宫室,类型为 Ti。Ti是一个1~3间的整数, 1表示
阅读全文
摘要:https://odzkskevi.qnssl.com/5e1fdf8cae5d11a8f572bae96d6095c0?v=1507521965 Perhaps you have heard of the legend of the Tower of Babylon. Nowadays many
阅读全文