201344: [AtCoder]ARC134 E - Modulo Nim

Memory Limit:1024 MB Time Limit:6 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

Score : $900$ points

Problem Statement

Snuke found a blackboard with nothing written on it.

He will do $N$ operations on this blackboard. In the $i$-th operation, he chooses an integer between $1$ and $a_i$ (inclusive) and writes it on the blackboard.

After $N$ integers are written on the blackboard, Taro The First and Jiro The Second will play a game using it. In the game, the two alternately do the operation below, with Taro The First going first.

  • Let $X$ be the largest integer written on the blackboard.
    • If $X=0$, the current player wins and the game ends.
  • Choose an integer $m$ between $1$ and $X$ (inclusive).
  • Replace each of the $N$ integers written on the blackboard with its remainder when divided by $m$.

There are $\prod_{i=1}^{N}a_i$ ways for Snuke to write numbers on the blackboard. Find the number of ways among them that will result in Taro The First's win if both players play optimally, modulo $998244353$.

Constraints

  • All values in input are integers.
  • $1 \leq N \leq 200$
  • $1 \leq a_i \leq 200$

Input

Input is given from Standard Input in the following format:

$N$
$a_1$ $a_2$ $\cdots$ $a_N$

Output

Print the number of ways to write integers that will result in Taro The First's win if both players play optimally, modulo $998244353$.


Sample Input 1

1
3

Sample Output 1

1
  • Taro The First will win only if Snuke writes $3$.
  • Otherwise, Taro The First can only play a move that makes the integer on the blackboard $0$.

Sample Input 2

2
5 10

Sample Output 2

47

Sample Input 3

20
200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200 200

Sample Output 3

273710435
  • Be sure to find the count modulo $998244353$.

Input

题意翻译

Snuke 见到了一个空的黑板、 Snuke 要在黑板上进行 $N$ 次操作,第 $i$ 次操作选择一个 $[1,a_i]$ 中的正整数,将之写在黑板上。 写完 $N$ 个数之后,先手太郎和后手次郎要在黑板上玩游戏。先手太郎先开始,两人轮流进行以下操作: + 考虑当前黑板上的最大数 $X$。 + 若 $X=0$,则当前操作的玩家**获胜**,游戏结束。 + 选择一个 $[1,X]$ 中的正整数 $m$。 + 将 $N$ 个数全部对 $m$ 取模。 对于 Snuke 所有可能的 $\prod_{i=1}^Na_i$ 种写数字的方法,若两人都采取最优策略,请求出先手太郎能获胜的情况数取模 $998244353$ 的结果。

加入题单

算法标签: