码迷,mamicode.com
首页 >  
搜索关键字:gap sequence    ( 7114个结果
ural Brackets Sequence (dp)
http://acm.timus.ru/problem.aspx?space=1&num=1183 很经典的问题吧,看的黑书上的讲解。 设dp[i][j]表示i到j括号合法需要的最少括号数。 共有四种情况: s[i]s[j]配对,dp[i][j] = min( dp[i][j] ,  dp[i-1][j+1] ); s[i] = '('或'[' dp[i][j] = min( d...
分类:其他好文   时间:2014-08-26 11:42:55    阅读次数:206
Permutation Sequence
The set [1,2,3,…,n] contains a total of n! unique permutations.By listing and labeling all of the permutations in order,We get the following sequence ...
分类:其他好文   时间:2014-08-25 22:49:25    阅读次数:274
UVa 10534 Wavio Sequence ( DP 二分 最长递增子序列 )
题意  求一个序列a某一位的最长递增序列(lis)和最长递减序列(lds)中最小值的最大值 开始直接用DP写了   然后就超时了  后来看到别人说要用二分把时间复杂度优化到O(n*logn)   果然如此   用一个栈s保存长度为i的LIS的最小尾部s[i]  top为栈顶即当前LIS的长度  初始s[1]=a[1]  top=1 遍历整个序列  当a[i]>s[top]时  a[i]入栈 ...
分类:其他好文   时间:2014-08-25 17:10:14    阅读次数:258
[BestCoder Round #6] hdu 4981 Goffi and Median (水题)
Goffi and Median Problem Description A median in a sequence with the length of n is an element which occupies position number ?n+12? after we sort the elements in the non-decreasing order ...
分类:其他好文   时间:2014-08-25 11:55:34    阅读次数:159
题目1004:Median
题目描述: Given an increasing sequence S of N integers, the median is the number at the middle position. For example, the median of S1={11, 12, 13, 14} is 12, and the median of S2={9, 10, 15, 16, 17} is 15. The median of two sequences is defined to be...
分类:其他好文   时间:2014-08-24 19:24:22    阅读次数:235
BestCoder3 1002 BestCoder Sequence(hdu 4908) 解题报告
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4908题目意思:给出 一个从1~N 的排列你和指定这个排列中的一个中位数m,从这个排列中找出长度为奇数,中位数是m的子序列有多少个。 我的做法被discuss 中的测试数据一下子就否定了。 这...
分类:其他好文   时间:2014-08-23 22:50:11    阅读次数:303
UVA 10829 - L-Gap Substrings(后缀数组)
UVA 10829 - L-Gap Substrings 题目链接 题意:一个字符串如果形如UGU,的形式,G的长度为L,那么称这个字符串为L串,给定一个字符串,问这个字符串子串为g串的个数 思路:做这题前先做了POJ3693,有一个思想就是枚举长度分段,这样的话对于一个U长度为l的而言,只要在当前位置和当前位置之后(l + g)的位置分别向前向后找lcp,两个lcp加起来的长度...
分类:其他好文   时间:2014-08-23 20:24:21    阅读次数:349
UVA - 11481 Arrange the Numbers
Consider this sequence {1, 2, 3, … , N}, as a initial sequence of firstN natural numbers. You can rearrange this sequence in many ways. Therewill be N! different arrangements. You have to calculate t...
分类:其他好文   时间:2014-08-23 15:27:01    阅读次数:202
poj3061 Subsequence ,尺取法
A sequence of N positive integers (10 < N < 100 000), each of them less than or equal 10000, and a positive integer S (S < 100 000 000) are given. Write a program to find the minimal length of the sub...
分类:其他好文   时间:2014-08-23 11:22:40    阅读次数:198
LeetCode: Word Break
LeetCode: Word BreakGiven a string s and a dictionary of words dict, determine if s can be segmented into a space-separated sequence of one or more di...
分类:其他好文   时间:2014-08-22 23:42:29    阅读次数:215
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!