Page 1 of 3


Posted: Wed Dec 12, 2001 9:48 am
by junjieliang
Isn't this problem LCS? Then why is it for the first input the output is "tg", instead of "tgc"?

Thanx :smile:.


Posted: Mon Mar 25, 2002 10:01 pm
by necropower
hey guys , i noticed that the input and the output for the first case is kind of odd.
it shows "atgc","tgc"
but the output is "tg"
isnt it "tgc"???
can u explain that?

[[]]'s Necropower

Posted: Tue Mar 26, 2002 1:24 pm
by ..
In the problem description:

So, the longest common sequence in the two strands atgc and tga is tg.

Is the sample input have typo??
My accetped program will output "tgc "for "atgc" and "tgc".........

Posted: Tue Mar 26, 2002 1:55 pm
by necropower
(i am using @ instead of interrogation, my keyboard is broken)

did u get accepted@
can u tell me your main idea of searching in strings@ my program is too slow and i didnt find a better way to search on the strings...


Posted: Tue Mar 26, 2002 5:50 pm
by ..
I think my algorithm is quite "brute force"

let's say there is string A, B

First check if the last char of B is a substring of A,
if yes, copy the last 2 chars and check again
if no, copy the last 2nd char to check......

just run like this......

Posted: Wed Mar 27, 2002 7:37 am
by Stefan Pochmann
Hmm... I'm confused... is it the longest common subsequence problem or the longest common substring problem? Of course there's no real definition in the problem, but it sounds like the subsequence problem. On the other hand, your approach sounds more like the substring problem? What is it?

Posted: Wed Mar 27, 2002 8:10 am
by ..
Yes, this question is to find sub-string...

Posted: Tue Apr 30, 2002 5:17 pm
by Den Raskovalov
Note: Sequence should be continious!
Also there is error in sample output.

Posted: Tue Jul 16, 2002 9:48 pm
by Caesum
The question says:
If there are more than one test cases, it must be a blank line between two consecutive, both in input and output files.
So I use 3 gets's to read the two strings and the next blank, however the next 'blank' line is not always a blank line ? Can anyone confirm the input format for me please ?

Posted: Tue Jul 16, 2002 10:13 pm
by Ivan Golubev
I've used

Code: Select all

while(scanf("%s %s\n", s1, s2) == 2) ...
and it was enough to get PE.

Posted: Wed Jul 17, 2002 12:17 am
by gvcormac
It is a common *substring* problem (I agree that the problem is ill-specified.)

The fastest possible algorithm (linear time) is to build a suffix tree. If you search the web you'll find references and code.


Posted: Sat May 10, 2003 3:39 am
by Eric3k
Prog 760, DNA sequencing,, in the first input, it has atgc and tgc and the corresponging output tg. However, shouldn't it be tgc?

Posted: Mon May 26, 2003 2:09 am
by negue
Yes. They probably meant atgc and tga as input.

Can someone give me some clues or i/o samples, because I guess I'm doing it right but I get wa.


760 - DNA Sequencing

Posted: Thu Jan 15, 2004 4:37 pm
by angga888
I got lot of WA for this problem.
Could someone please tell me the output of this input:
Any tricky I/O for this problem?



Posted: Mon Feb 09, 2004 3:59 pm
by sohel
I am also getting WA for this problem.

Isn't simply LCS;

I applied LCS and sorted all the answers lexicographically and avoided repetition. Shouldn't it be enough.