QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 256 MB Total points: 100

#1642. 圆环之理

统计

圆环上等距排列着 $n$ 个点,我们将任意两个点之间直接连接一条线段,请你给每个点染一个 $1\sim a$ 的颜色,每条线段染一个 $1\sim b$ 中的颜色,使得这个圆环任意旋转一个不是 $2\pi$ 倍数的角度,或者沿任意直线反转,图案都与原先不相同。请你计算这个方案数取模 $998244353$。

本题的 $n$ 会以一种特殊的方式给出,以保证你能够直接获得它的质因子分解式。

输入格式

第一行输入一个正整数 $k$,表示 $n$ 可以写作 $k$ 个质数的乘积。

第二行输入 $k$ 个质数 $p_1, p_2, \dots, p_k$,$n$ 为它们的乘积。

第三行输入两个正整数 $a,b$,意义如题所示。

输出格式

输出一行一个整数,表示方案数取模 $998244353$。

样例数据

样例 1 输入

1
3
2 2

样例 1 输出

24

子任务

对于 $40\%$ 的数据,$n=3\sim 42$ 各一个测试点,每个测试点占 $1$ 分。

对于 $75\%$ 的数据,$n\le 10^{12}$。

对于 $100\%$ 的数据,$p_i \le 10^9, 3\le n\le 10^{18}, 1\le a, b\le 10^8$。

About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.