405728: GYM102056 C Heretical … Möbius
Description
Rikka was walking around the school building curiously until a strange room with a door number of 404 caught her eyes.
It seemed like a computer room — there were dozens of computers lying orderly, but papers, pens, and whiteboards everywhere built up a nervous atmosphere. Suddenly, Rikka found some mysterious codes displayed on a computer which seemed to have nothing different from others — is this a message from inner world?
Excited Rikka started her exploration. The message was generated by a program named for_patterns_in_mobius which outputted a string $$$s$$$ of length $$$10^9$$$, containing the value of $$$\lvert \mu(x) \rvert$$$ for $$$x = 1, 2, \dots, 10^9$$$ in order.
Suddenly, Rikka heard footsteps outside. She quickly took a screenshot and left. The screenshot recorded a string $$$t$$$ of length $$$200$$$, perhaps a substring of $$$s$$$. Now Rikka wonders if it is really a substring of $$$s$$$, and if so, where it first appears in $$$s$$$.
Could you help her to decipher the codes?
InputThere are $$$10$$$ lines in total. Each line contains $$$20$$$ characters, each of which is either "0" or "1". $$$t$$$ is the concatenation of them — the result of concatenating them in order.
OutputOutput a single integer in the only line. If $$$t$$$ is a substring of $$$s$$$, output the first position it appears in $$$s$$$, that is, the minimum positive integer $$$p$$$ such that all the digits $$$\lvert \mu(p+i) \rvert$$$ for $$$i = 0, 1, \dots, 199$$$ form the string $$$t$$$. Otherwise output $$$-1$$$.
ExamplesInput11101110011011101010 11100100111011101110 11100110001010101110 11001110111011001110 01101110101011101000 11101110111011100110 01100010111011001110 11101100101001101110 10101110010011001110 11101110011011101010Output
1Input
01010101010101010101 10101010101010101010 01010101010101010101 10101010101010101010 01010101010101010101 10101010101010101010 01010101010101010101 10101010101010101010 01010101010101010101 10101010101010101010Output
-1Note
The definition of $$$\mu()$$$ is as follows:
For any positive integer $$$x$$$, let $$$x = \prod_{i=1}^k {p_i}^{c_i}$$$ be the regular factorization of $$$x$$$, where $$$p_i$$$ is a unique prime, $$$c_i$$$ is a positive integer, and if $$$x=1$$$ then $$$k=0$$$. Consequently, $$$\mu(x)$$$ is defined as $$$$$$ \mu(x)= \begin{cases} 0 & \exists c_i>1, \\ (-1)^k & \text{otherwise} \\ \end{cases} $$$$$$