zoj 1076 Gene Assembly
来源:互联网 发布:mac怎么用html5看视频 编辑:程序博客网 时间:2024/05/22 10:48
Statement of the Problem
With the large amount of genomic DNA sequence data being made available, it is becoming more important to find genes (parts of the genomic DNA which are responsible for the synthesis of proteins) in these sequences. It is known that for eukaryotes (in contrast to prokaryotes) the process is more complicated, because of the presence of junk DNA that interrupts the coding region of genes in the genomic sequence. That is, a gene is composed by several pieces (called exons) of coding regions. It is known that the order of the exons is maintained in the protein synthesis process, but the number of exons and their lengths can be arbitrary.
Most gene finding algorithms have two steps: in the first they search for possible exons; in the second they try to assemble a largest possible gene, by finding a chain with the largest possible number of exons. This chain must obey the order in which the exons appear in the genomic sequence. We say that exon i appears before exon j if the end of i precedes the beginning of j.
The objective of this problem is, given a set of possible exons, to find the chain with the largest possible number of exons that cound be assembled to generate a gene.
Input Format
Several input instances are given. Each instance begins with the number 0 < n < 1000 of possible exons in the sequence. Then, each of the next n lines contains a pair of integer numbers that represent the position in which the exon starts and ends in the genomic sequence. You can suppose that the genomic sequence has at most 50000 basis. The input ends with a line with a single 0.
Output Format
For each input instance your program should print in one line the chain with the largest possible number of exons, by enumerating the exons in the chain. If there is more than one chain with the same number of exons, your program can print anyone of them.
Sample Input
6
340 500
220 470
100 300
880 943
525 556
612 776
3
705 773
124 337
453 665
0
Sample Output
3 1 5 6 4
2 3 1
(1)通过寻找一条拥有尽可能多的外显子的基因链,这条链必须遵循外显子出现在基因组序列中的顺序,外显子i在外显子j的前面的条件是i得末尾必须在j的开头的前面(按外显子的结束位置升序)。
#include <iostream>#include <algorithm>using namespace std;struct node{ int start; int end; int pos;};int cmp(const void *a,const void *b){ node *a1=(node *)a; node *b1=(node *)b; return a1->end-b1->end;}int main(){ int n; node a[1000]; while (cin>>n && n) { for (int i=0; i<n; i++) { cin>>a[i].start>>a[i].end; a[i].pos=i+1; } qsort(a, n, sizeof(node), cmp); cout<<a[0].pos; int prew=a[0].end; for (int i=1; i<n; i++) { if(a[i].start>prew) { cout<<" "<<a[i].pos; prew=a[i].end; } } cout<<endl; } return 0;}
- zoj 1076 Gene Assembly
- ZOJ 1076 Gene Assembly
- zoj - 1076 - Gene Assembly
- zoj 1076 Gene Assembly
- ZOJ-1076 Gene Assembly
- Zoj 1076 Gene Assembly
- zoj 1076 Gene Assembly
- zoj 1076 Gene Assembly
- ZOJ 1076 Gene Assembly
- ZOJ 1076 Gene Assembly(LIS)
- ZOJ 1076 Gene Assembly LIS
- ZOJ 1076 Gene Assembly 贪心
- zoj 1076 Gene Assembly 解题报告
- ZOJ Problem Set - 1076 Gene Assembly
- ZOJ 1076 Gene Assembly(贪心算法)
- ZOJ 1076Gene Assembly(很简单的贪心)
- ZOJ 1076 Gene Assembly (贪心求区间不相交问题)
- Gene Assembly
- ZOJ 1276 Optimal Array Multiplication Sequence
- 无线路由器与modem的IP冲突问题剖析及解决(家庭上网)
- LightOJ 1221 Travel Company(贝尔曼最短路判负环)
- centos6.5安装虚拟机和win系统后共享文件
- 安捷伦今日正式拆分 是德科技正式开始运营
- zoj 1076 Gene Assembly
- hdoj 4901 多校联合4 1005
- Row
- 翻译的国外大牛的教程【fatal error C1083: 无法打开包括文件:“SDKDDKVer.h”】亲测有效!
- PO BO VO DTO POJO DAO概念及其作用(附转换图)
- ABAP Objects: Overriding (Redefinition)
- POJ 3613 Cow Relays floyd+快速幂
- DB-DAY 5 JavaScript的disabled属性
- SVN update: 'skipped' message