HDU1560 DNA sequence(IDA*)题解】的更多相关文章

题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1560 DNA sequence Time Limit: 15000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 2999    Accepted Submission(s): 1462 Problem Description The twenty-first centu…
题意:给定一些DNA序列,求一个最短序列能够包含所有序列. 思路:记录第i个序列已经被匹配的长度p[i],以及第i序列的原始长度len[i].则有两个剪枝: 剪枝1:直接取最长待匹配长度.1900ms int h = 0; for(int i = 0; i < n; ++i) { h = max(len[i] - p[i], h); //最大待匹配长度 } 剪枝二:统计每个序列里面四种序列值,并求得每种序列值的最长长度.将四种序列值加起来就是最长待匹配长度.180ms int cal() { /…
DNA sequence Time Limit: 15000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 3503    Accepted Submission(s): 1681 Problem Description The twenty-first century is a biology-technology developing century. We kn…
DNA sequence Time Limit : 15000/5000ms (Java/Other)   Memory Limit : 32768/32768K (Java/Other) Total Submission(s) : 15   Accepted Submission(s) : 7 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description The twenty-first century…
题目: The twenty-first century is a biology-technology developing century. We know that a gene is made of DNA. The nucleotide bases from which DNA is built are A(adenine), C(cytosine), G(guanine), and T(thymine). Finding the longest common subsequence…
题目地址:http://acm.hdu.edu.cn/showproblem.php?pid=1560 BFS题解:http://www.cnblogs.com/crazyapple/p/3218107.html 构造一个串,使得它包含所有的给定DNA序列,并且要求长度最短.采用dfs策略,对于每个串定义1个指针,当全部指针为串尾时判断构造的长度,由于状态空间过大,但是又存在冗余搜索,可以用迭代加深将状态减少.最长待构造长度 + 当前长度 < 迭代的最大深度则直接return,大大减少了状态数.…
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=1560 题目大意:给出n个字符串,让你找一个字符串使得这n个字符串都是它的子串,求最小长度. 解题思路:迭代加深搜索,迭代加深搜索,就是限制DFS的深度deep,若搜不到答案,则加深深度,重新搜索,这样就防止了随着深度不断加深而进行的盲目搜索.这题的迭代深度deep以这n个子串中的最长长度作为起点,不断+1,知道找到符合条件的字符串.每次DFS的时候,都要判断一下,当前的深度+最少还有加深的深度是否大…
HDU 1560 DNA sequence(DNA序列) Time Limit: 15000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)   Problem Description - 题目描述 The twenty-first century is a biology-technology developing century. We know that a gene is made of DNA. Th…
DNA sequence Time Limit : 15000/5000ms (Java/Other)   Memory Limit : 32768/32768K (Java/Other) Total Submission(s) : 15   Accepted Submission(s) : 7 Font: Times New Roman | Verdana | Georgia Font Size: ← → Problem Description The twenty-first century…
题目链接:https://vjudge.net/problem/POJ-2778 DNA Sequence Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 18479   Accepted: 7112 Description It's well known that DNA Sequence is a sequence only contains A, C, T and G, and it's very useful to…
DNA sequence 直接中文了 题目描述 21世纪是生物科技飞速发展的时代.我们都知道基因是由DNA组成的,而DNA的基本组成单位是A,C,G,T.在现代生物分子计算中,如何找到DNA之间的最长公共子序列是一个基础性问题. 但是我们的问题不是那么简单:现在我们给定了数个DNA序列,请你构造出一个最短的DNA序列,使得所有我们给定的DNA序列都是它的子序列. 例如,给定"ACGT","ATGC","CGTT","CAGT"…
DNA sequence Time Limit: 15000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submission(s): 4217    Accepted Submission(s): 2020 Problem Description The twenty-first century is a biology-technology developing century. We kno…
It's well known that DNA Sequence is a sequence only contains A, C, T and G, and it's very useful to analyze a segment of DNA Sequence,For example, if a animal's DNA sequence contains segment ATC then it may mean that the animal may have a genetic di…
DNA Sequence Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 9899   Accepted: 3717 Description It's well known that DNA Sequence is a sequence only contains A, C, T and G, and it's very useful to analyze a segment of DNA Sequence,For exa…
DNA Sequence 题意:DNA的序列由ACTG四个字母组成,如今给定m个不可行的序列.问随机构成的长度为n的序列中.有多少种序列是可行的(仅仅要包括一个不可行序列便不可行).个数非常大.对100000取模. 思路:推荐一个博客,讲的很清楚. 这样的题目.n非常大,首先想到的就是用矩阵来优化.那么怎样构造转移方程呢:首先建立一棵Trie,然后依照AC自己主动机的方式构造fail指针,然后会发现.当一个状态分别加入ACTG之后,会得到还有一个状态. (详细解释见代码) 代码: /* ID:…
http://acm.hdu.edu.cn/showproblem.php?pid=1560 DNA sequence Time Limit: 15000/5000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others) Total Submission(s): 732    Accepted Submission(s): 356 Problem Description The twenty-first century is a…
DNA Sequence Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 11860   Accepted: 4527 Description It's well known that DNA Sequence is a sequence only contains A, C, T and G, and it's very useful to analyze a segment of DNA Sequence,For ex…
DNA Sequence Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 11860   Accepted: 4527 Description It's well known that DNA Sequence is a sequence only contains A, C, T and G, and it's very useful to analyze a segment of DNA Sequence,For ex…
DNA Sequence   Description It's well known that DNA Sequence is a sequence only contains A, C, T and G, and it's very useful to analyze a segment of DNA Sequence,For example, if a animal's DNA sequence contains segment ATC then it may mean that the a…
DNA Sequence Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 19991   Accepted: 7603 Description It's well known that DNA Sequence is a sequence only contains A, C, T and G, and it's very useful to analyze a segment of DNA Sequence,For ex…
DNA Sequence Time Limit: 1000MS   Memory Limit: 65536K Total Submissions: 9889   Accepted: 3712 Description It's well known that DNA Sequence is a sequence only contains A, C, T and G, and it's very useful to analyze a segment of DNA Sequence,For exa…
目录 Ural 1248 Sequence Sum 题解 题意 题解 程序 Ural 1248 Sequence Sum 题解 题意 给定\(n\)个用科学计数法表示的实数\((10^{-100}\sim10^{100})\),输出它们的和. Tip: 一个实数可以用科学计数法表示为\(x\times10^y\),其中\(1\le x<10\) \(x\)为实数,\(y\)是整数.输入时表示为\(xey\).保证输入的实数有\(19\)位有效数字.输出时用科学计数法,必须包括\(19\)位正确数…
DNA Sequence Description It's well known that DNA Sequence is a sequence only contains A, C, T and G, and it's very useful to analyze a segment of DNA Sequence,For example, if a animal's DNA sequence contains segment ATC then it may mean that the ani…
Description It's well known that DNA Sequence is a sequence only contains A, C, T and G, and it's very useful to analyze a segment of DNA Sequence,For example, if a animal's DNA sequence contains segment ATC then it may mean that the animal may have…
题目大意:有n个DNA序列,构造一个新的序列,使得这n个DNA序列都是它的子序列,然后输出最小长度. 题解:第一次接触IDA*算法,感觉~~好暴力!!思路:维护一个数组pos[i],表示第i个串该匹配第pos[i]个元素.一共有四种可能,A,C,G,T,依次枚举,如果说A和n个串中的第j个串匹配,就直接就pos[j]++就行了,然后进入下一层,如果说最终没有成功构造,还有进行回溯,所以每一层我们都要维护一个数组来记录pos的值方便回溯. 具体实现和注释都在code中了,应该不难理解. code:…
万恶之源 翻译 题意就是给出N个DNA序列,要求出一个包含这n个序列的最短序列是多长 这是一道搜索题,为什么呢?从样例可以感受到,我们应该从左往右"扫描",从n个DNA序列中取出某个特定的字母,直到n个序列都被取空.题目便是要求这个"取出"次数的最小值.而我们每次都选择A,T,C,G中的其中一个取出,这样便形成了一个不断以4个叶子延申的搜索树了.(请自行脑补)(当然实际必须要剪掉) IDA* 这题很适合用IDA*,随着深度不断增加,第一个访问到的答案一定是最优解.而…
题意:给出m个模式串,要求你构造长度为n(n <= 2000000000)的主串,主串不包含模式串,问这样的主串有几个 思路:因为要不包含模式串,显然又是ac自动机.因为n很大,所以用dp不太好. 在图论中,如果我们知道一个图的邻接矩阵A,$A_{ij}$ = 1表示i走一步到j有一条路,那么$A^n$中的$A_{ij}$就是这个图中从i走n步到j的路径数. 所以用ac自动机我们创造一个所有后缀的邻接矩阵A,那么用矩阵快速幂$A^n$就求出了所有的路径数,$\sum_{i = 1}^n A_{0…
Problem Description The twenty-first century is a biology-technology developing century. We know that a gene is made of DNA. The nucleotide bases from which DNA is built are A(adenine), C(cytosine), G(guanine), and T(thymine). Finding the longest com…
题目给m个病毒串,问不包含病毒串的长度n的DNA片段有几个. 感觉这题好神,看了好久的题解. 所有病毒串构造一个AC自动机,这个AC自动机可以看作一张有向图,图上的每个顶点就是Trie树上的结点,每个结点都可以看作是某个病毒串的前缀,Trie树的根则是空字符串. 而从根出发,在AC自动机上跑,经过k次转移到达某个结点,这个结点所代表的病毒串前缀可以看作长度为k的字符串的后缀,如果接下去跑往ATCG四个方向转移,就能到达新的结点,转移到新的长k+1字符串的后缀. 这样带着一个后缀状态的转移就能绕开…
The twenty-first century is a biology-technology developing century. We know that a gene is made of DNA. The nucleotide bases from which DNA is built are A(adenine), C(cytosine), G(guanine), and T(thymine). Finding the longest common subsequence betw…