P17057 [NWERC 2022] Interview Question
Description
*Fizz Buzz* is a party game that is often used as a programming exercise in job interviews. In the game, there are two positive integers $a$ and $b$, and the game consists of counting up through the positive integers, replacing any number by `Fizz` if it is a multiple of $a$, by `Buzz` if it is a multiple of $b$, and by `FizzBuzz` if it is a multiple of both $a$ and $b$. The most common form of the game has $a=3$ and $b=5$, but other parameters are allowed.
Your task here is to solve the reverse problem: given a transcript of part of the game, not necessarily starting at $1$, find possible values of $a$ and $b$ that could have been used to generate it.
The original statement shows some sample sequences for various values of $a$ and $b$.
:::align{center}

:::
Figure: Fizz Buzz implemented in Hexagony.
Input Format
The input consists of:
- One line with two integers $c$ and $d$ ($1 \leq c \leq d \leq 10^5$), indicating that your transcript starts at $c$ and ends at $d$.
- One line with $d-c+1$ integers and strings, the contents of the transcript.
It is guaranteed that the transcript is valid for some integers $a$ and $b$ with $1 \leq a,b \leq 10^6$, according to the rules laid out above.
Output Format
Output two positive integers $a$ and $b$ ($1 \leq a,b \leq 10^6$) that are consistent with the given transcript.
If there are multiple valid solutions, you may output any one of them.