1

You have two lists of $N$ integers $x_{i}$ and $y_{i}$ where $i\in\{ 0,1,\dots,N-1\}$. We know the value of $x_{0}$ and $y_{0}$, remaining $N-1$ values is calculated using formula given below:

$$x_i=(x_{i-1}*p_{x}+a_{x})\bmod x_{m} \\ y_i=(y_{i-1}*p_{y}+a_{y})\bmod y_{m}$$

$p_x$, $a_x$, $x_m$, $p_y$, $a_y$, $y_m$ are given in question.

How to find the minimum possible value of the following formula:

$$ \sum_{i=0}^{n-1} |f(x_i)-y_i| $$

Where $f$ is a function from integer to integer (means a function that can take only integer value as input and give integer value as output) and has a special property. For a given value of $C$, $f$ satisfies the following condition--

$$f(2f(x)-x+1)=f(x)+C$$

Please give me some hint on how to solve this problem.

Gerry Myerson
  • 179,216

0 Answers0