[SOLUTION] Two chandeliers Codeforces -2021
SOLUTION
” CLICK HERE “
Vasya is a CEO of a big construction company. And as any other big boss he has a spacious, richly furnished office with two crystal chandeliers. To stay motivated Vasya needs the color of light at his office to change every day. That's why he ordered both chandeliers that can change its color cyclically. For example: red – brown – yellow – red – brown – yellow and so on.[SOLUTION] Two chandeliers Codechef -2021
There are many chandeliers that differs in color set or order of colors. And the person responsible for the light made a critical mistake — they bought two different chandeliers.[SOLUTION] Two chandeliers Codechef -2021
Since chandeliers are different, some days they will have the same color, but some days — different. Of course, it looks poor and only annoys Vasya. As a result, at the
Your task is to calculate the day, when it happens (counting from the day chandeliers were installed). You can think that Vasya works every day without weekends and days off.
The first line contains three integers
The second line contains
The third line contains
At the
It's guaranteed that sequence
Print the single integer — the index of day when Vasya will become angry.
4 2 4 4 2 3 1 2 1
5
3 8 41 1 3 2 1 6 4 3 5 7 2 8
47
1 2 31 1 1 2
62
In the first example, the chandeliers will have different colors at days
![[SOLUTION] Two chandeliers Codechef -2021 [SOLUTION] Two chandeliers Codechef -2021](https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhNwkV1OWnUvg_oYtU_cCFwNL1LiNTcx-Zt61THEEdZSeOWZcG66_RyrIQ2sGopuPLSM5dtv_odYeSMAZYXTFgUQjrlxPTrN5VhwHPsfi_AoRZ7l0IVwlPcRziXJZL6yJnp-1gzrysbjnJ8/w320-h213/pexels-negative-space-97077-min.jpg)
Social Plugin