Given a prime $P$ and one of its primitive roots $g$, and $n$ positive integers $\lbrace a_ i\rbrace_ {i=0}^ {n-1}$, for each $a_ i$ output the minimum non-negative integer $b_ i$ that satisfies $g^ {b_ i}\equiv a_ i\pmod P$.
$P$ $g$ $n$
$a_ 0$
$a_ 1$
:
$a_ {n-1}$
$b_ 0$
$b_ 1$
:
$b_ {n-1}$
998244353 3 6 1 3 9 27 578373382 100
0 1 2 3 100 500620418
| No. | Testdata Range | Score |
|---|