题解: dp+树状数组优化 dp[i]表示以i结尾时的非递减数组和.这样做的复杂度是o(n^2),不行 观察这个dp for(int i=1;i<=n;i++){ dp[i]=1; for(int j=1;j<i;j++) if(a[j]<=a[i]) dp[i]=(dp[i]+dp[j])%mod ...
分类:
其他好文 时间:
2016-09-22 19:55:15
阅读次数:
170
标签:动态规划 题目描述: Given a string S and a string T, count the number of distinct subsequences of T in S. A subsequence of a string is a new string which is ...
分类:
其他好文 时间:
2016-09-09 06:31:11
阅读次数:
140
枚举,二分,$RMQ$。 对于一个序列来说,如果固定区间左端点,随着右端点的增大,最大值肯定是非递减的,最小值肯定是非递增的。 因此,根据这种单调性,我们可以枚举区间左端点$L$,二分找到第一个位置${{p_1}}$,使得$\mathop {\max }\limits_{i = L}^{{p_1}} ...
分类:
其他好文 时间:
2016-09-04 14:15:57
阅读次数:
163
Given a string S and a string T, count the number of distinct subsequences of T in S. A subsequence of a string is a new string which is formed from t ...
分类:
其他好文 时间:
2016-08-23 16:40:26
阅读次数:
153
题目链接:http://codeforces.com/contest/597/problem/C 给你n和数(1~n各不同),问你长为k+1的上升自序列有多少。 dp[i][j] 表示末尾数字为i 长度为j的上升子序列个数,但是dp数组是在树状数组的update函数中进行更新。 update(i, ...
分类:
编程语言 时间:
2016-08-06 23:28:56
阅读次数:
370
Subsequences Summing to Sevens 题目描述 Farmer John's N cows are standing in a row, as they have a tendency to do from time to time. Each cow is labeled w ...
分类:
其他好文 时间:
2016-08-06 00:19:21
阅读次数:
189
Description Alice has a sequence A, She wants to split A into as much as possible continuous subsequences, satisfying that for each subsequence, every ...
分类:
其他好文 时间:
2016-08-05 00:31:56
阅读次数:
190
Friends and Subsequences Friends and Subsequences Mike and !Mike are old childhood rivals, they are opposite in everything they do, except programming ...
分类:
其他好文 时间:
2016-07-13 11:42:57
阅读次数:
212
D - Friends and Subsequences Description Mike and !Mike are old childhood rivals, they are opposite in everything they do, except programming. Today t ...
分类:
其他好文 时间:
2016-07-12 23:03:32
阅读次数:
226
Description: Given two string S and T, you need to count the number of T's subsequences appeared in S. The fucking problem description is so confusing ...
分类:
其他好文 时间:
2016-07-11 16:54:51
阅读次数:
186