QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 512 MB Total points: 100 Hackable ✓

#7374. 迷途知返

Statistics

题目描述

有一条 $n+1$ 个点的链,设其从一端到另一端的编号依次为 $0,1,\dots,n$。忆艾想知道有多少条从 $0$ 出发,又回到原点的欧拉回路,满足:经过 $(i-1,i)$ 这条边的次数恰为 $2d_i$。你只需要输出答案对 $998244353$ 取模的结果。

输入格式

第一行输入一个正整数 $n$。

接下来一行输入 $n$ 个正整数,第 $i$ 个为 $d_i$。

输出格式

输出一个整数表示方案数同余 $998244353$。

样例 1

输入

2
2 1

输出

2

解释

走一步后,可以选择继续前进或者折返,再往后都只有唯一选择。

样例 2

输入

4
200 30 8 11

输出

812059605

数据范围

对于 $100\%$ 的数据,保证 $1\le n,d_i\le 10^5$。

时间限制 $1\,\mathrm{s}$,空间限制 $512\,\mathrm{MB}$。

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.