P4932 Browser
Background
When playing Slay the Spire on Edge, __stdcall often finds that the mouse stops working, which makes her very upset. Therefore, she decided to let you experience the pain caused by Edge as well.
Description
__stdcall gives you $n$ points. The $i$-th point has weight $x_i$. For two points $u$ and $v$, if the result of $x_u \operatorname{xor}x_v$ has an odd number of $1$'s in its binary representation, then connect an Edge between $u$ and $v$. Now __stdcall wants you to find how many Edges there are in total.
If you fail to complete the task, then __stdcall will make you suffer a bit, and you will get no score for this test case.
Input Format
One line with six integers: $n$, $a$, $b$, $c$, $d$, $x_0$.
$n$ is the number of points. The weight of each point needs to be generated in the following way.
You need to use $a$, $b$, $c$, $d$, and $x_0$ to generate an array x. The generation method is:
$$x_i = (ax_{i-1}^2 + bx_{i-1} + c) \bmod d$$
$x_i$ is the weight of the $i$-th point. The point indices are from $1$ to $n$.
Output Format
Output one integer, representing the total number of Edges.
Explanation/Hint
Let $v$ denote the maximum value among the weights.
For the first $20\%$ of the data, $n \le 10$.
For the first $40\%$ of the data, $n \le 100$.
For the first $60\%$ of the data, $n \le 1000$.
For the first $80\%$ of the data, $n \le 1 \times 10^6$.
For the first $90\%$ of the data, $v \le 1 \times 10^6$.
For $100\%$ of the data, $n \le 1 \times 10^7,v \le 1 \times 10^9$.
It is guaranteed that $a$, $b$, $c$, $d$, and $x_0$ are all non-negative integers within `int`.
Translated by ChatGPT 5