QOJ.ac

QOJ

时间限制: 1 s 内存限制: 256 MB 总分: 100

#5040. $k$-ty pierwiastek Dirichleta

统计

Matematyk Pang poznał splot Dirichleta podczas poprzedniego obozu. Jednak w porównaniu z głębokim uczeniem przez wzmacnianie, wydało mu się to zbyt łatwe. Dlatego zrobił coś specjalnego.

Jeśli $f, g : \{1, 2, \dots, n\} \to \mathbb{Z}$ są dwiema funkcjami z liczb całkowitych dodatnich w liczby całkowite, to splot Dirichleta $f * g$ jest nową funkcją zdefiniowaną jako:

$$(f * g)(n) = \sum_{d|n} f(d)g\left(\frac{n}{d}\right)$$

Definiujemy $k$-tą potęgę funkcji $g = f^k$ jako:

$$f^k = \underbrace{f * \dots * f}_{k \text{ razy}}$$

W tym zadaniu chcemy rozwiązać problem odwrotny: mając dane $g$ oraz $k$, należy znaleźć funkcję $f$ taką, że $g = f^k$.

Ponadto istnieje dodatkowy warunek, że $f(1)$ oraz $g(1)$ muszą być równe $1$. Wszystkie operacje arytmetyczne wykonywane są w ciele $\mathbb{F}_p$, gdzie $p = 998244353$, co oznacza, że w splocie Dirichleta:

$$(f * g)(n) = \left(\sum_{d|n} f(d)g\left(\frac{n}{d}\right)\right) \pmod p$$

Wejście

Pierwsza linia zawiera dwie liczby całkowite $n$ oraz $k$ ($2 \le n \le 10^5$, $1 \le k < 998244353$).

Druga linia zawiera $n$ liczb całkowitych $g(1), g(2), \dots, g(n)$ ($0 \le g(i) < 998244353$, $g(1) = 1$).

Wyjście

Jeśli rozwiązanie nie istnieje, wypisz $-1$.

W przeciwnym razie wypisz $f(1), f(2), \dots, f(n)$ ($0 \le f(i) < 998244353$, $f(1) = 1$). Jeśli istnieje wiele rozwiązań, wypisz dowolne z nich.

Przykład

Wejście 1

5 2
1 8 4 26 6

Wyjście 1

1 4 2 5 3

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
#216EditorialOpen题解jiangly2025-12-13 00:16:09View

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.