hdu4681 String DP(2013多校第8场)】的更多相关文章

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4681 思路: 我是胡搞过的 就是先预处理出(i,j)的正向的最大连续子串和逆向最大连续子串 然后对于A,B分别将满足包含C串的所有子串的开头和结尾坐标起来 那么ans=min(dp1[i-1][j-1]+len+dp2[i+1'][j'+1]),其中(i,i')(j.j')分别表示在A,B串中C串的开头和结尾坐标,len为C串长度 代码:…
String Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 11    Accepted Submission(s): 4 Problem Description Given 3 strings A, B, C, find the longest string D which satisfy the following rules:a)…
题意: There is a city which is built like a tree.A terrorist wants to destroy the city's roads. But now he is alone, he can only destroy one road, then the city will be divided into two cities. Impression of the city is a number defined as the distance…
题意:求一棵树中不在一条链中的三个点的对数. 转化一下,用总对数减去在一条链上的三点对数即可. 考虑经过根节点,然后可能是不同的子树中各选一个:或者是子树中选一个,然后当前节点为根的子树以外的节点选一个. 这样不重不漏 代码简单. #define maxn 100005 struct node { int v,next; }; node e[maxn * ]; int head[maxn]; int cnt ; i64 ans ; i64 sum ; i64 sz[maxn]; i64 n ;…
今天悲剧了,各种被虐啊,还是太年轻了 Crime 这道题目给的时间好长,第一次就想到了暴力,结果华丽丽的TLE了. 后来找了一下,发现前24个是1, 2, 6, 12, 72, 72, 864, 1728, 13824, 22032, 555264, 476928, 17625600, 29599488, 321115392, 805146624, 46097049600, 36481536000, 2754120268800, 3661604352000, 83905105305600, 19…
Y Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 60    Accepted Submission(s): 20 Problem Description   Sample Input 4 1 2 1 3 1 4   Sample Output 1 Hint 1. The only set is {2,3,4}. 2. Please…
Terrorist’s destroy Time Limit: 6000/3000 MS (Java/Others)    Memory Limit: 65535/32768 K (Java/Others)Total Submission(s): 24    Accepted Submission(s): 6 Problem Description There is a city which is built like a tree.A terrorist wants to destroy th…
Sum Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 94    Accepted Submission(s): 41 Problem Description   Sample Input 2   Sample Output 2 Hint 1. For N = 2, S(1) = S(2) = 1. 2. The input fil…
Editor Time Limit: 3000/2000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 118    Accepted Submission(s): 38 Problem Description   Sample Input 8 I 2 I -1 I 1 Q 3 L D R Q 2   Sample Output 2 3 Hint The following…
Answers Time Limit: 2000/1000 MS (Java/Others)    Memory Limit: 131072/131072 K (Java/Others)Total Submission(s): 25    Accepted Submission(s): 16 Problem Description   Sample Input 2 4 2 2 2 1 0 1 2 3   Sample Output NO YES YES YES   Source 2013 Mul…