#P15556. [CCPC 2025 哈尔滨站] 函数求和
[CCPC 2025 哈尔滨站] 函数求和
Problem Description
Let the prime factorization of be:
$$n=\prod\limits_{i=1}^k p_i^{\alpha_i},\ p_1<p_2<\cdots<p_k$$Now you are given a sequence of length with no repeated elements. Define as:
$$f(n)=\prod\limits_{i=1}^m p_{r_i}\times \alpha_{r_i}$$If , we treat .
You are given queries. In each query, an is given, and you need to compute the value of
$$\sum\limits_{i=1}^{\lfloor\frac{n}{x}\rfloor}f(ix)\bmod 2^{32}$$for multiple queries.
To reduce output size, please output the XOR of all query answers. In particular, will be given in the form of its prime factorization.
Input Format
The first line contains three integers ($1 \le n \le 7 \times 10^8, 1 \le m \le 25, 1 \le q \le 5 \times 10^5$), representing the upper bound parameter, the length of the sequence , and the number of queries.
The second line contains integers (, and all are distinct).
The next lines describe the queries. In the -th line, an integer is given first, indicating the number of prime factorization terms of . Then integers are given ( are primes and are pairwise distinct), meaning
It is guaranteed that and .
In particular, if , then .
Output Format
Output one line containing one integer, which is the XOR of the answers to all queries.
10 2 5
2 3
0
1 5 1
1 2 1
1 7 1
2 2 1 3 1
31
Hint
Translated by ChatGPT 5