摘要: 最长公共子序列(LCS)是经典的DP问题,求序列a[1...n], b[1..m]的LCS。状态是DP[i][j],表示a[1..i],b[1..j]的LCS。DP转移方程是DP[i][j]= DP[i-1][j-1]+1, a[i] == b[j] max{ DP[i][j-1], DP[i... 阅读全文
posted @ 2015-08-16 22:36 Pat 阅读(290) 评论(0) 推荐(0) 编辑
摘要: 传送门DescriptionA kingdom has n cities numbered 1 to n, and some bidirectional roads connecting cities. The capital is always city 1.After a war, all th... 阅读全文
posted @ 2015-08-14 19:01 Pat 阅读(193) 评论(0) 推荐(0) 编辑
摘要: 传送门Time Limit:5000MSMemory Limit:65536KB64bit IO Format:%lld & %lluDescription在一个奇怪的村子中,很多人的名字都很长,比如aaaaa, bbb and abababab。名字这么长,叫全名显然起来很不方便。所以村民之间一般... 阅读全文
posted @ 2015-08-14 17:24 Pat 阅读(223) 评论(0) 推荐(0) 编辑
摘要: 传送门Time Limit:1000MSMemory Limit:131072KB64bit IO Format:%lld & %lluDescriptionIn this problem, a dictionary is collection of key-value pairs, where k... 阅读全文
posted @ 2015-08-14 15:22 Pat 阅读(167) 评论(0) 推荐(0) 编辑
摘要: 传送门Closest Common AncestorsTime Limit:2000MSMemory Limit:10000KTotal Submissions:17306Accepted:5549DescriptionWrite a program that takes as input a ro... 阅读全文
posted @ 2015-08-13 19:38 Pat 阅读(191) 评论(0) 推荐(0) 编辑
摘要: 传送门考研路茫茫——空调教室Time Limit: 4000/2000 MS (Java/Others)Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 2445Accepted Submission(s): 720Probl... 阅读全文
posted @ 2015-08-13 12:40 Pat 阅读(302) 评论(0) 推荐(0) 编辑
摘要: 这是DFS系列的第二篇 割边的概念 In graph theory, a bridge, isthmus, cut-edge, or cut arc is an edge of a graph whose deletion increases its number of connected comp 阅读全文
posted @ 2015-08-08 16:53 Pat 阅读(4608) 评论(0) 推荐(0) 编辑
摘要: 传送门 B. Mike and Fun time limit per test 2 seconds memory limit per test 256 megabytes input standard input output standard output Mike and some bears 阅读全文
posted @ 2015-08-08 03:12 Pat 阅读(238) 评论(0) 推荐(0) 编辑
摘要: 传送门 D. One-Dimensional Battle Ships time limit per test 1 second memory limit per test 256 megabytes input standard input output standard output D. On 阅读全文
posted @ 2015-08-07 04:04 Pat 阅读(370) 评论(0) 推荐(0) 编辑
摘要: 传送门 Even the most successful company can go through a crisis period when you have to make a hard decision — to restructure, discard and merge departme 阅读全文
posted @ 2015-08-06 11:33 Pat 阅读(457) 评论(0) 推荐(0) 编辑