QOJ.ac

QOJ

Límite de tiempo: 1 s Límite de memoria: 256 MB Puntuación total: 100

#1642. 圆环之理

Estadísticas

円環上に等間隔に配置された $n$ 個の点があり、任意の2点間を線分で結びます。各点に $1 \sim a$ のいずれかの色を、各線分に $1 \sim b$ のいずれかの色を塗り、円環を $2\pi$ の倍数ではない角度だけ回転させた場合、または任意の直線で反転させた場合に、パターンが元の状態と一致しないようにします。この塗り方の総数を $998244353$ で割った余りを求めてください。

本問における $n$ は、その素因数分解を直接得られるような特殊な形式で与えられます。

入力

1行目に正整数 $k$ が与えられます。これは $n$ が $k$ 個の素数の積として表されることを示します。

2行目に $k$ 個の素数 $p_1, p_2, \dots, p_k$ が与えられます。$n$ はこれらの積です。

3行目に2つの正整数 $a, b$ が与えられます。意味は問題文の通りです。

出力

塗り方の総数を $998244353$ で割った余りを1行で出力してください。

入出力例

入力 1

1
3
2 2

出力 1

24

小課題

$40\%$ のデータについて、$n=3 \sim 42$ の各値に対して1つのテストケースがあり、各テストケースは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$ です。

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.