AtCoder Regular Contest 227
F
擦除与提升
Erase and Raise
AtCoder
⌀ 3159
原题
← E→

擦除与提升AI (CI翻译)

Problem Statement

题目描述

AI (CI翻译)

There is an integer sequence $A=(0,0,\ldots,0)$ of length $N$. The following operation is repeated as long as it can be performed.

有一个长度为 $N$ 的整数序列 $A=(0,0,\ldots,0)$。只要还能执行以下操作,就重复执行该操作。AI (CI翻译)

  • Choose a pair of integers $(i,j)$ satisfying $1\le i\lt j\le |A|$ and $A_i=A_j$.
  • Remove $A_i$ and $A_j$ from the sequence.
  • Add $1$ to every element that was between $A_i$ and $A_j$ immediately before the removal.
  • 选择一对满足 $1\le i\lt j\le |A|$ 且 $A_i=A_j$ 的整数 $(i,j)$。
  • 从序列中移除 $A_i$ 和 $A_j$。
  • 将移除前位于 $A_i$ 和 $A_j$ 之间的每个元素都加 $1$。
AI (CI翻译)

Here, $|A|$ denotes the length of the sequence $A$ at that point.

这里,$|A|$ 表示此时序列 $A$ 的长度。AI (CI翻译)

Find the number, modulo $998244353$, of possible sequences when no more operations can be performed. If the final sequences are the same, they are not distinguished even if the process of operations differs. A sequence of length $0$ is also counted as one sequence.

请求出当无法再执行任何操作时,可能得到的不同序列数量,结果对 $998244353$ 取模。如果最终序列相同,则即使操作过程不同,也视为同一个序列。长度为 $0$ 的序列也计作一个序列。AI (CI翻译)

Constraints

约束条件

AI (CI翻译)
  • $1 \le N \le 2 \times 10^5$
  • All input values are integers.
  • $1 \le N \le 2 \times 10^5$
  • 所有输入值均为整数。
AI (CI翻译)

Input

输入格式

AI (CI翻译)

The input is given from Standard Input in the following format:

输入从标准输入中按以下格式给出:AI (CI翻译)

N

N
AI (CI翻译)

Output

输出格式

AI (CI翻译)

Output the answer.

输出答案。AI (CI翻译)

样例

Input #1
1
Output #1
1
No operation can be performed, so there is one possible final sequence: $(0)$.
Input #2
5
Output #2
3
There are three possible final sequences: $(0)$, $(1)$, $(2)$.
Input #3
7
Output #3
8
Depending on the choices made during the operations, eight different sequences can be obtained.
Input #4
200000
Output #4
159211719
Be sure to find the count modulo $998244353$.
题目信息
题号
arc227_f
时间限制
5 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(gpt-6.1-sol),如有出入请以原文为准。