#P17254. 线性筛 2
线性筛 2
Background
Stealing the testdata and directly printing the output to grab the best solution is a serious violation. Depending on the severity, your account may be permanently banned.
It got dark.
Then it got bright again.
The sun shines on this lowland,
shining on every tiny and precious life.
Problem Description
Given a multiplicative function and a modulus , for each , compute .
Input Format
The first line contains two positive integers .
Then there are lines. On the -th line there are integers; the -th integer is , where is the -th prime.
Output Format
Output one non-negative integer, which is .
20 1000000000
2 4 8 16
3 9
5
7
11
13
17
19
501702414
Hint
For all testdata, , , , and it is not guaranteed that is prime.
The time limit has been increased to more than times that of std.
Translated by ChatGPT 5