随笔分类 - dp
摘要:神秘的咒语 思路: LCIS dp[i][j]表示第一个字串a前i个和第二个字串b前j个以b[j]结尾的最长公共上升子序列的最大长度。 那么很容易想到n3的方法,$$\begin{cases} dp[i][j] = max(dp[i 1][j],dp[i][j])(a[i]!=
阅读全文
摘要:ACTIV Activities Ana likes many activities. She likes acrobatics, alchemy, archery, art, Arabic dances, and many more. She joined a club that offers s
阅读全文
摘要:D. Book of Evil time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Paladin Manao caught the
阅读全文
摘要:Balancing Act Time Limit: 1000MS Memory Limit: 65536K Total Submissions: 12703 Accepted: 5403 Description Consider a tree T with N (1 <= N <= 20,000)
阅读全文
摘要:Anniversary party Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Submission(s): 9976 Accepted Submission(s): 42
阅读全文
摘要:Computer Time Limit: 1000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 6378 Accepted Submission(s): 3211 Proble
阅读全文
摘要:The more, The Better Time Limit: 6000/2000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 7867 Accepted Submission(s)
阅读全文
摘要:E. Santa Claus and Tangerines time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Santa Clau
阅读全文
摘要:D. Chloe and pleasant prizes time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output D. Chloe an
阅读全文
摘要:Game Accepts: 138 Submissions: 358 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 131072/131072 K (Java/Others) Game Accepts: 138 Submissions: 3
阅读全文
摘要:B. Arpa's weak amphitheater and Mehrdad's valuable Hoses time limit per test 1 second memory limit per test 256 megabytes input standard input output
阅读全文
摘要:J. Bottles time limit per test 2 seconds memory limit per test 512 megabytes input standard input output standard output Nick has n bottles of soda le
阅读全文
摘要:C. Watching Fireworks is Fun time limit per test 4 seconds memory limit per test 256 megabytes input standard input output standard output C. Watching
阅读全文
摘要:Fence Time Limit: 1000MS Memory Limit: 30000K Total Submissions: 4705 Accepted: 1489 Description A team of k (1 <= K <= 100) workers should paint a fe
阅读全文
摘要:1383 整数分解为2的幂 基准时间限制:1 秒 空间限制:131072 KB 任何正整数都能分解成2的幂,给定整数N,求N的此类划分方法的数量!由于方案数量较大,输出Mod 1000000007的结果。比如N = 7时,共有6种划分方法。7=1+1+1+1+1+1+1 =1+1+1+1+1+2 =
阅读全文
摘要:C. Journey time limit per test 3 seconds memory limit per test 256 megabytes input standard input output standard output C. Journey time limit per tes
阅读全文
摘要:3942 - Remember the Word 思路:字典树+dp dp[i]前i个字符,能由给的字串组成的方案数,那么dp[i] = sum(dp[i-k]);那么只要只要在字典树中查看是否有字串str[i-k+1,i]就行了;
阅读全文
摘要:1079 - Just another Robbery PDF (English) Statistics Forum Time Limit: 4 second(s) Memory Limit: 32 MB As Harry Potter series is over, Harry has no jo
阅读全文
摘要:1804: 有向无环图 Description Bobo 有一个 n 个点,m 条边的有向无环图(即对于任意点 v,不存在从点 v 开始、点 v 结束的路径)。 为了方便,点用 1,2,…,n 编号。 设 count(x,y) 表示点 x 到点 y 不同的路径数量(规定 count(x,x)=0),
阅读全文
摘要:1354 选数字 基准时间限制:1 秒 空间限制:131072 KB 当给定一个序列a[0],a[1],a[2],...,a[n-1] 和一个整数K时,我们想找出,有多少子序列满足这么一个条件:把当前子序列里面的所有元素乘起来恰好等于K。 样例解释: 对于第一个数据,我们可以选择[3]或者[1(第一
阅读全文