QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 256 MB Total points: 100

#22440. Sequenziamento DNA

Statistics

Farmer John studia la genealogia: $M$ tori ($1 \le M \le 20$), $F$ mucche ($1 \le F \le 20$), ma non conosce le discendenze possibili.

Conosce la sequenza DNA unica $DNA_{i}$ di ciascuno. $DNA_{i}$ ha lunghezza $25$, solo maiuscole A, $C$, G, T. Cerca i figli possibili di ogni coppia toro/mucca.

Per ogni coppia stampa quanti altri bovini possono essere figli se:

  1. non sono nessuno dei genitori: mucca non propria madre, toro non proprio padre;

  2. ogni posizione DNA coincide con almeno un genitore nella stessa posizione.

abc può venire da (axx, xbc), non da (aaa, bbb).

Considera sequenze di $3$ tori e $2$ mucche:

       Bull 1: GTTTTTTTTTTTTTTTTTTTTTTTT
       Bull 2: AATTTTTTTTTTTTTTTTTTTTTTT
       Bull 3: GATTTTTTTTTTTTTTTTTTTTTTT
       Cow 1:  TTTTTTTTTTTTTTTTTTTTTTTTT
       Cow 2:  ATTTTTTTTTTTTTTTTTTTTTTTT

Toro $2$ e mucca $1$ possono essere genitori della mucca $2$:

       Bull 2: AATTTTTTTTTTTTTTTTTTTTTTT
       Cow 1:  TTTTTTTTTTTTTTTTTTTTTTTTT
       Cow 2:  ATTTTTTTTTTTTTTTTTTTTTTTT

Il suo primo A può venire dal toro $2$, secondo T dalla mucca $1$, resto da qualunque genitore.

Crea la matrice dei numeri di figli possibili per ogni coppia.

Input

  • Riga $1$: interi $M$ e $F$ separati da spazi.

  • Righe $2..M+1$: la riga $i+1$ dà la sequenza $DNA_{i}$ del toro $i$.

  • Righe $M+2..M+F+1$: la riga $j+M+1$ dà la sequenza $DNA_{j}$ della mucca $j$.

Output

  • Righe $1..M$: riga $i$, $F$ interi separati; il $j$-esimo conta figli possibili del toro $i$ e mucca $j$.

Esempi

Input 1

2 3
TGAAAAAAAAAAAAAAAAAAAAAAA
AGAAAAAAAAAAAAAAAAAAAAAAA
ATAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAAAAA
TTAAAAAAAAAAAAAAAAAAAAAAA

Output 1

2 1 0
0 0 2

Note

DNA di $2$ tori seguito da quello di $3$ mucche.

Considera toro $1$ e mucca $1$:

    b1: TGAAAAAAAAAAAAAAAAAAAAAAA
    c1: ATAAAAAAAAAAAAAAAAAAAAAAA

La parte importante è {T|A} seguita da {G|T}.

Prove di corrispondenza per toro $0$ e mucca $0$:

    b1: TGAAAAAAAAAAAAAAAAAAAAAAA -- parent, can't be offspring
    b2: AGAAAAAAAAAAAAAAAAAAAAAAA offspring! Matches [TA][GT]
    c1: ATAAAAAAAAAAAAAAAAAAAAAAA -- parent, can't be offspring
    c2: AAAAAAAAAAAAAAAAAAAAAAAAA -- second character is 'A'; must be G or T
    c3: TTAAAAAAAAAAAAAAAAAAAAAAA offspring! Matches [TA][GT]

Bull / Cow; parent, can't be offspring; offspring! Matches; second character is A; must be G or T: toro; mucca; genitore, non può essere figlio; figlio! Corrisponde; secondo carattere A, deve essere G o T

Il primo elemento è $2$; gli altri analoghi.

Autore del problema: Jacob Steinhardt, 2010

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.