随笔分类 -  1-8-动态规划-其他DP

摘要:石子游戏(简单) 原题链接 思路: 通过形式容易看出是一道DP。其中异或和的情况只有64种,所以我们可以开一维来记录当前异或和的状态。 在[l,r]利用dp[当前位置][异或和][是否选择当前]来进行状态转移。时间复杂度为O(qnm)。 比赛时这道题卡了好久,思路很清晰,但就是跑不出正确结果。后来发 阅读全文
posted @ 2020-09-21 14:06 yzm10 阅读(251) 评论(0) 推荐(0)
摘要:双倍快乐 题目描述 Illyasviel:"你想要最长不下降子序列吗?" star-dust:"好啊!" Illyasviel:"老板,给我整两个最长不下降子序列,要最大的。" 求序列 a 中的两个不相交的不下降子序列使得他们的元素和的和最大,子序列可以为空。 注 1:序列 a 不下降的定义是不存在 阅读全文
posted @ 2019-06-29 01:06 yzm10 阅读(474) 评论(0) 推荐(0)
摘要:Play Game Alice and Bob are playing a game. There are two piles of cards. There are N cards in each pile, and each card has a score. They take turns t 阅读全文
posted @ 2019-01-28 01:46 yzm10 阅读(320) 评论(0) 推荐(0)
摘要:The Battle of Chibi Cao Cao made up a big army and was going to invade the whole South China. Yu Zhou was worried about it. He thought the only way to 阅读全文
posted @ 2018-10-11 20:15 yzm10 阅读(254) 评论(0) 推荐(0)
摘要:Campus Design Campus Design Nanjing University of Science and Technology is celebrating its 60th anniversary. In order to make room for student activi 阅读全文
posted @ 2018-09-21 17:21 yzm10 阅读(232) 评论(0) 推荐(0)
摘要:Mathematical Curse 22.25% 1000ms 65536K A prince of the Science Continent was imprisoned in a castle because of his contempt for mathematics when he w 阅读全文
posted @ 2018-09-15 18:07 yzm10 阅读(493) 评论(0) 推荐(0)
摘要:Mondriaan's Dream Mondriaan's Dream Squares and rectangles fascinated the famous Dutch painter Piet Mondriaan. One night, after producing the drawings 阅读全文
posted @ 2018-09-11 21:07 yzm10 阅读(171) 评论(0) 推荐(0)
摘要:Hard to prepare 28.63% 1000ms 262144K After Incident, a feast is usually held in Hakurei Shrine. This time Reimu asked Kokoro to deliver a Nogaku show 阅读全文
posted @ 2018-09-09 17:11 yzm10 阅读(250) 评论(0) 推荐(0)
摘要:Find a path Frog fell into a maze. This maze is a rectangle containing NN rows and MM columns. Each grid in this maze contains a number, which is call 阅读全文
posted @ 2018-08-27 21:56 yzm10 阅读(186) 评论(0) 推荐(0)
摘要:方格取数 设有N*N的方格图(N<=10),我们将其中的某些方格中填入正整数,而其他的方格中则放人数字0。如下图所示(见样例 ,黄色和蓝色分别为两次走的路线,其中绿色的格子为黄色和蓝色共同走过的): A B 某人从图的左上角的A点出发,可以向下行走,也可以向右走,直到到达右下角的B 点。在走过的路上 阅读全文
posted @ 2018-08-21 21:37 yzm10 阅读(237) 评论(0) 推荐(0)
摘要:LIS(nlogn) LCS(nlogn) 阅读全文
posted @ 2018-08-19 19:53 yzm10 阅读(363) 评论(0) 推荐(0)
摘要:D-money 链接:https://www.nowcoder.com/acm/contest/140/D来源:牛客网 时间限制:C/C++ 1秒,其他语言2秒 空间限制:C/C++ 131072K,其他语言262144K 64bit IO Format: %lld 时间限制:C/C++ 1秒,其他 阅读全文
posted @ 2018-07-24 21:22 yzm10 阅读(264) 评论(0) 推荐(0)
摘要:Games Time Limit: 1000 ms Memory Limit: 65536 KiB Submit Statistic Problem Description Alice and Bob are playing a stone game. There are nn piles of s 阅读全文
posted @ 2018-07-19 18:10 yzm10 阅读(374) 评论(0) 推荐(0)
摘要:回文字符串 回文串是指aba、abba、cccbccc、aaaa这种左右对称的字符串。每个字符串都可以通过向中间添加一些字符,使之变为回文字符串。 回文字符串 例如:abbc 添加2个字符可以变为 acbbca,也可以添加3个变为 abbcbba。方案1只需要添加2个字符,是所有方案中添加字符数量最 阅读全文
posted @ 2018-04-19 00:09 yzm10 阅读(325) 评论(0) 推荐(0)
摘要:回文串划分 有一个字符串S,求S最少可以被划分为多少个回文串。 例如:abbaabaa,有多种划分方式。 a|bb|aabaa - 3 个回文串 a|bb|a|aba|a - 5 个回文串 a|b|b|a|a|b|a|a - 8 个回文串 其中第1种划分方式的划分数量最少。 a|bb|aabaa - 阅读全文
posted @ 2018-04-18 23:40 yzm10 阅读(346) 评论(0) 推荐(0)
摘要:最全DP总结 https://blog.csdn.net/cc_again/article/details/25866971 ACM题集 https://blog.csdn.net/liuqiyao_01/article/details/9079611 数位dp模板讲解 https://blog.c 阅读全文
posted @ 2018-04-13 15:57 yzm10 阅读(236) 评论(0) 推荐(0)
摘要:Permutation Counting Given a permutation a1, a2, … aN of {1, 2, …, N}, we define its E-value as the amount of elements where ai > i. For example, the 阅读全文
posted @ 2018-04-12 16:52 yzm10 阅读(330) 评论(0) 推荐(0)
摘要:免费馅饼 都说天上不会掉馅饼,但有一天gameboy正走在回家的小径上,忽然天上掉下大把大把的馅饼。说来gameboy的人品实在是太好了,这馅饼别处都不掉,就掉落在他身旁的10米范围内。馅饼如果掉在了地上当然就不能吃了,所以gameboy马上卸下身上的背包去接。但由于小径两侧都不能站人,所以他只能在 阅读全文
posted @ 2017-08-15 22:24 yzm10 阅读(155) 评论(0) 推荐(0)
摘要:命运 穿过幽谷意味着离大魔王lemon已经无限接近了! 可谁能想到,yifenfei在斩杀了一些虾兵蟹将后,却再次面临命运大迷宫的考验,这是魔王lemon设下的又一个机关。要知道,不论何人,若在迷宫中被困1小时以上,则必死无疑! 可怜的yifenfei为了去救MM,义无返顾地跳进了迷宫。让我们一起帮 阅读全文
posted @ 2017-08-15 22:10 yzm10 阅读(270) 评论(0) 推荐(0)
摘要:Longest Ordered Subsequence A numeric sequence of ai is ordered if a1 < a2 < ... < aN. Let the subsequence of the given numeric sequence ( a1, a2, ... 阅读全文
posted @ 2017-08-15 21:46 yzm10 阅读(152) 评论(0) 推荐(0)