Participate in exhilarating programming contests, solve unique algorithm and data structure challenges and be a part of an awesome community.

After the fight in the *Natagumo Mountain*, Tanjiro felt the need to get sharper. Because in recent fights he has been missing the opening threads which shortens the fight by allowing him to defeat an opponent in one blow through that opening thread. While staying in the *Butterfly Mansion*, Tanjiro gets help from the residents of the mansion to improve his ability to find an opening thread as soon as possible.

As he spars with one of the residents of *Butterfly Mansion*, *Kanao*, the three servants of the mansion are tasked with monitoring the sparring of *Tanjiro* and *Kanao.* One of the trio watches *Tanjiro*, one watches *Kanao* and the last one compiles the observations of the first two and takes it to *Shinobu*, host of the mansion.

What Shinobu gets is **two arrays of integers,** $A$ **and** $B$**, of length** $m$ **and** $n$**. The first one is the fighting strategy of Kanao and the second is Tanjiro’s.** Shinobu observes the observations and **if she finds some(at least one) non-negative** $x$ **and** $d$**, such that for every** $i(0 \leq i < m)$**,** $A[i]$ **being the** $i$**-th element of** $A$ **and** $B[x+i \times d]$ **being the** $(x+i \times d)$**-th element of** $B$**,** $A[i] - B[x+i \times d]$**, stays the same, she will be ensured that Tanjiro found at least one opening.** After that Shinobu will stop the sparring session and tell Tanjiro, “* I can see you're working very hard.*”, if Tanjiro found an opening, “

`Please do all that you can.`

The first line of input contains $m$ and $n$. Second-line contains $m$ integers, denoting the fighting strategy array of Kanao, $A$ and the third line contains $n$ integers, denoting the fighting strategy array of Tanjiro, $B$.

$1 \leq m \leq n \leq 100$

The array elements will be positive and within $10^{9}$

You have to output a single line, **what Shinobu will say to Tanjiro (without quotes)**, based on the observation.

Input | Output |
---|---|

6 13 4 23 6 5 7 9 12 1 6 2 25 6 8 12 7 7 9 10 11 | I can see you're working very hard. |

In the first case, if we take $x=2$ and $d=2$ and for every $i(0 \leq i < m)$, we get the following elements of array $B$ by taking all the $(x+i \times d)$-th element: ${6, 25, 8, 7, 9, 11}$. And the elements of array $A$ are: ${4, 23, 6, 5, 7, 9}$. So here we can see that, $(4-6)=(23-25)=(6-8)=(5-7)=(7-9)=(9-11)$. So, we can say that an opening exists. |

Input | Output |
---|---|

4 10 7 1 9 8 1 2 3 4 5 6 7 8 9 10 | Please do all that you can. |

No such $x$ and $d$ are found where for every $i(0 \leq i < m)$, $A[i] - B[x+i \times d]$, stays the same. |

100% Solution Ratio

alamkhanEarliest,

IU_SpiralForgeFastest, 0.0s

alamkhanLightest, 33 kB

IU_SpiralForgeShortest, 1262B

Login to submit

If read carefully, the problem is very clear and straightforward. You are given two arrays, you have...