prince专题

uva 10635 - Prince and Princess(LCS)

题目连接:10635 - Prince and Princess 题目大意:给出n, m, k,求两个长度分别为m + 1 和 k + 1且由1~n * n组成的序列的最长公共子序列长的。 解题思路:按一般的o(n^2)的算法超时了,所以上网查了下LCS装换成LIS的算法o(nlogn)。算法仅仅是将其中的一个序列重新标号1~m,然后按最长公共子序列的方法去做。 #in

The Frog Prince (青蛙王子) and Hello Kitty

The Frog Prince [青蛙王子] and Hello Kitty 1. Hello Kitty.gif2. The Frog Prince (青蛙王子) .gifReferences 1. Hello Kitty.gif Hello Kitty, also known by her real name Kitty White, is a fictional cha

The Little Prince-12/06

The Little Prince-12/06   “That doesn't matter. Draw me a sheep.”   When the prince ask the planet to draw a sheep for him, the planet says that he has never drawn a sheep and he told the little cha

例题27 UVa10635 Prince and Princess(DP:LIS的nlogn算法)

题意: 看白书 要点: 这题本来应该是LCS,但因为时间的要求,可以转化为LIS,而且还得用nlogn的算法,基本思路就是用b数组来存储当前b的值在a数组中对应的位置。LIS的nlogn算法的思路就是,每次用g来存储,并每次在其中进行二分查找,注意这里每次更新是不会改变LIS的性质的,最后g的结果不是所需的LIS,这里要注意一下。 #include<iostream>#include

2011 ACM/ICPC 北京赛区 J题 Gem and prince

这道题很暴力,各种搜索都能过关键是怎么搜。 很重要的剪枝是开一个数组存所有颜色的个数,然后每次搜的时候相应减掉消除的个数,然后比较剩余的分数与当前最大得分,小的话直接返回。 不加这个就会TLE。 然后搜索也不要很裸的每个位置都搜,应该是一块一块的搜,否则会TLE; 16180 247 Accepted 2378ms 144kb G++ 3747B 2011-10-26 10: