#P9511. Soybeanization Sequence
Soybeanization Sequence
Soybeanization Sequence
Given an integer sequence \(\{t_n\}\), we form an infinite sequence \(\{a_n\}\) by repeating \(\{t_n\}\) infinitely. Define the soybeanization transformation \(S\) on a sequence \(\{a_n\}\) to produce a new sequence \(\{b_n\}\) as follows:
- Initially, \(b_n = a_n\) for all \(n \ge 1\).
- For each positive integer \(n\) (in increasing order), perform the following:
- For each integer \(i \ge 2\) (in increasing order) while \(i \le n\), update \[ b_n \mathrel{\texttt{-}=} b_{\lfloor n/i \rfloor}, \] where \(\lfloor n/i \rfloor\) is the floor of \(n/i\).
Define the \(k\)-soybeanized sequence as the sequence obtained by applying the soybeanization transformation \(k\) times consecutively (i.e. \(S^k(a)\)).
Your task is: Given the sequence \(\{t_n\}\) of length \(L\) used to build \(\{a_n\}\) by infinite repetition, and two integers \(m\) and \(k\), compute the \(m\)-th element of the \(k\)-soybeanized sequence modulo \(23068673\) (a prime number).
Note: The sequence is 1-indexed. All formulas above should be interpreted with respect to 1-indexing.
inputFormat
The input consists of two lines:
- The first line contains three integers \(L\), \(m\), and \(k\), where \(L\) is the length of the sequence \(\{t_n\}\), \(m\) is the index of the term to output, and \(k\) is the number of soybeanization operations.
- The second line contains \(L\) integers representing the sequence \(\{t_n\}\).
outputFormat
Output one integer: the \(m\)-th element of the \(k\)-soybeanized sequence modulo \(23068673\).
sample
3 5 1
1 2 3
23068671