ГлавнаяСборникиТурнирыРазделыФорумыУчастникиПечатьПомощьО системе

Турниры > CEN303_2016Questions > задача:


HW023. 50741 - DNA Distance

CEN303_2016Questions

Старт: 28.окт.2016 в 17:00:00
Финиш: 01.ноя.2016 в 05:00:00
Турнир завершён!
• Турнирная таблица

Гость
• Вопросы к жюри (7)

Задачи турнира

• FE1. 51076 - Key person
• FE2. 50988 - Laplacian Filter
• FE3. 51075 - Shortest Path for Bishop
• HW011. 51008 - Sum of Regional M...
• HW012. 51009 - Sum of the nth row
• HW021. 51011 - Decoding the Path
• HW022. 51012 - Palindrome-k
• HW023. 50741 - DNA Distance
• HW031. 51015 - Student Scholarships
• HW032. 51014 - Nine Men's Morris g...
• HW033. 50925 - Optimizing Elevator...
• HW051. 51019 - Finding the hidden...
• HW052. 51020 - Number of nodes r...
• HW061. 50448 - Paint Buckets
• HW062. 51021 - Number of Nodes
• HW071. 51042 - The most frequent ...

Обратная связь

Если у вас есть предложения или пожелания по работе Contester, посетите форум сайта www.contester.ru.

Лимит времени 2000/4000/4000/4000 мс. Лимит памяти 65000/65000/65000/65000 Кб.
Question by Ibrahim Mesecan.

Distance

In bioinformatics, sequence alignment is a way of arranging the sequences of DNA, RNA, or protein to identify regions of similarity. For easy processing, you have numbered all proteins. If two proteins are in the same positions, the distance is 0. Otherwise, the difference in the positions is the distance of these two proteins.

Question: You are given two sequences and you want to compare and find out how similar these two sequences are. Write a program that is going to read two DNA sequence information. Then, your program will print the total distance of all proteins. Note: if a number is not in the other sequence, then their distance is taken as the number of elements in the sequence (n).

Input specification
You will be given an integer (n) the length of DNA sequences where 0 ≤ n ≤ 2000. Then, in the following two lines you will be given two comma separated DNA sequences with the length n (n integers where each of the numbers is less than 1e6).

Output specification
Show the total distance of these sequences.

Sample Input I
6
1, 5, 3, 4, 7, 2,
6, 5, 2, 3, 7, 4,
Sample Output I
12

Explanation:

  • 1 is not in the second list: distance is 6
  • 5 and 7 are in the same positions: distance is 0
  • 3 is in the third position in the first list and it's in position 4th in the second list: distance is 1
  • For 4, distance is 2
  • For 2, distance is 3
Thus, the total distance is 6 + 0 + 0 + 1 + 2 + 3 = 12.



Для отправки решений необходимо выполнить вход.

www.contester.ru