#GL0000393. Nghịch đảo Dirichlet và tổng tiền tố (Dirichlet Inverse and Prefix Sums)
Bài tập thuộc lộ trình
Mục lục đề ⌄
Nghịch đảo Dirichlet và tổng tiền tố (Dirichlet Inverse and Prefix Sums)
Dirichlet Inverse and Prefix Sums
Source: Library Checker
Version: Phuoc Hung OJ Extended
Problem Statement
Define and let its distinct elements in increasing order be .
For a sequence only its prefix sums at are given. We guarantee .
Its inverse under Dirichlet convolution is the sequence satisfying
Compute the prefix sums at all , modulo .
Input
A line containing 1, then , then the values . PHOJ uses one case per file.
Full bound: , matching the original Library Checker bound. The reference implementation uses a faster quotient-table algorithm.
Output
The values , modulo .
Subtasks
-
Subtask 1 (20 points): , , , .
-
Subtask 2 (30 points): , , , .
-
Subtask 3 (50 points): , , , .
Examples
Input
1
10
1 2 3 5 10
Output
1 0 998244352 998244351 998244352
Explanation
has prefix . Its Dirichlet inverse is the Möbius function. The sums at are respectively, giving the displayed modular residues.