#C11822. DNA Sequence Acceptance
DNA Sequence Acceptance
DNA Sequence Acceptance
In this problem, you are given an authorized DNA sequence and an input DNA sequence. Your task is to determine whether the input DNA sequence can be accepted by the system.
A DNA sequence is accepted if the number of positions at which the input sequence differs from the authorized sequence is at most \( m \). Formally, if we denote the authorized sequence as \( A \) and the input as \( B \) (both of length \( n \)), then the sequence is accepted if:
\[ \sum_{i=1}^{n} \mathbb{1}_{\{A_i \neq B_i\}} \leq m \]Otherwise, the sequence is rejected.
inputFormat
The input is given via stdin and consists of three lines:
- The first line contains two integers \( n \) and \( m \), where \( n \) represents the length of the authorized DNA sequence and \( m \) is the maximum number of allowed mismatches.
- The second line contains the authorized DNA sequence (a string of length \( n \)).
- The third line contains the input DNA sequence (a string of length \( n \)).
outputFormat
Output a single line to stdout:
True
if the input DNA sequence is accepted (i.e. there are at most \( m \) mismatches),False
otherwise.
5 1
ACGTA
ACGTT
True
</p>