You're welcome.
And would you mind me ask another question? Why the complexity of problem G is $O(q\log q)$, not $O(q)$ or $O(q\log V)$(you can regard $V$ as $10^9+7$, for the complexity of quick power)? Thanks.
You're welcome.
And would you mind me ask another question? Why the complexity of problem G is $O(q\log q)$, not $O(q)$ or $O(q\log V)$(you can regard $V$ as $10^9+7$, for the complexity of quick power)? Thanks.