問題一覧 > 通常問題

No.2817 Competition

レベル : / AI推定難易度 : 2150 / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 41
作問者 : highlighter / テスター : Magentor hirayuu_yc Yoyoyo8128 zeta7532 warabi0906
お気に入りにしたユーザー ProblemId : 10940 / 自分の提出
問題文最終更新日: 2025-09-27 11:52:30
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 437 ('09 Contest 002 day2) (順位表) の他の問題:

Story

You do not necessarily need to read this section.

Consider the situation of dividing people into teams for some competition.

Let the strength of a team simply be the total strength of the people belonging to that team. Then, for the same number of teams, the larger the product of the strengths of all teams, the less unbalanced the division can be considered to be.

Let us consider performing such a calculation for all possible team divisions.

Problem Statement

You are given a sequence $A$ of length $N$. A set $S$ of sets of positive integers is called a "good grouping" if it satisfies all of the following.

  • For any element $T$ of $S$, $\lvert T \rvert \geq 1$
  • $\displaystyle\sum_{T \in S} \lvert T \rvert = N$
  • For any distinct elements $T,U$ of $S$, $T \cap U=\varnothing$
  • For every integer $i$ between $1$ and $N$, inclusive, there exists some $T \in S$ such that $i \in T$

For every good grouping $S$, compute the following value, and find the sum of these values. Since the answer can be very large, output it modulo $998244353$.

  • $\displaystyle\prod_{T \in S} \displaystyle\sum_{i \in T} A_{i}$

Constraints

  • $1 \leq N \leq 2 \times 10^{5}$
  • $1 \leq A_{i} \leq 10^{18}$
  • All inputs are integers.

Input

The input is given from standard input in the following format.
$N$
$A_{1}~~~A_{2} ~~\ldots ~~A_{N}$

Output

Output the answer.

Sample

Sample 1
Input
3
1 2 3
Output
34

We have $S=\{\{1\},\{2,3\}\},\{\{2\},\{1,3\}\},\{\{3\},\{1,2\}\},\{\{1\},\{2\},\{3\}\},\{\{1,2,3\}\}$. The sum of the values is $1\times(2+3)+2\times(1+3)+3\times(1+2)+1\times2\times3+(1+2+3)=34$.

Sample 2
Input
1
1
Output
1

Sample 3
Input
5
1 1 1 1 1
Output
196

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。