#P9920. 「RiOI-03」变换,反演
「RiOI-03」变换,反演
Background
For the needs of this problem, we redefine multiplicative functions: it is not guaranteed that .
Problem Description
This is a non-traditional problem.
You are given a multiplicative function . For each test point, we will provide in the attachment the values of for selected terms , and this part will also appear in the input. Then, for each test point, there are queries. For each query, an integer is given; please output the value of .
Input Format
The first line contains . Each of the next lines contains two positive integers, and .
Then two numbers are given, representing the number of queries and the test point ID. For each query, one positive integer is given.
Output Format
For each query, output one non-negative integer representing the answer.
10
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
3 -1
1
2
3
1
1
2
Hint
Sample Explanation
Since , we have , so the result is correct.
Constraints
For each test point:
If you correctly answer the testdata with , you will get of the score.
If you correctly answer all testdata, you will get the remaining . So, if you cannot answer correctly, please output a random number to keep the format correct.
Constraints
Translated by ChatGPT 5