QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 512 MB Total points: 100

#13458. Spring, taking shape under the snow, sprouting branches

Statistics

"Hey, Yukino, that competition is still going on, right?"

"Yes. The loser must obey the winner..."

Yukino answered the sudden topic with a puzzled look. Yuigahama stepped forward, gently took her arm, and spoke to her in a clear voice.

"I already know the answer to the problem you're facing now, Yukino."

Yuigahama gently stroked Yukino's sleeve.

The problem that troubled Yukino was reflected in her actions and words.

Moreover, Haruno Yukinoshita had once explicitly stated that she didn't know what to do about the current Yukino Yukinoshita. What exactly was she referring to? Her relationship with her mother, her sister, or with us. It could be one of them, or perhaps all of them.

"I..."

Yukino's tone was full of confusion. She hung her head powerlessly, and the words "I don't know" that followed were so soft they seemed as if they would dissipate into the wind the next moment.

"I think... that is probably the answer between us."

In the end, neither she nor I understood.

If we understood, it would surely begin to collapse, so we would put a lid on it and pretend we couldn't see it slowly rotting away. So, since it would come to an end no matter what we did, at least let us not lose anything else.

This is the conclusion that the end of the path we are currently walking will give us.

Yuigahama paused briefly, shook her head gently, and then looked at us sincerely once more.

"So, therefore... if I win, I want to take everything. Maybe this is cunning... But this is the only way I can think of... I hope we can always stay the way we are now."

So Yuigahama placed this answer, this sole conclusion, before us first. Regardless of the conditions, assumptions, or formulas, she chose to ignore them all.

She was saying that no matter what processes we go through, what situations we encounter, or what impossible equations we struggle with, the answer alone cannot change. Like a dream, we will spend this happy time together forever.

"What do you think?"

Why on earth would Yui say such a thing? Is this what she likes?

It is not, but there is no way to change it. Endless mistakes, unreachable answers.

Perhaps, only the permutation is correct.


A permutation of length $n$ is correct if and only if it contains no non-trivial (length not equal to $1$ or $n$) contiguous subsequence whose values are also contiguous (see Note). For example, $[2413]$ is correct, but $[132]$ is incorrect (because $32$ is a non-trivial contiguous subsequence of $132$), and $[7164532]$ is also incorrect (because $[6453]$, $[64532]$, and $[164532]$ are all non-trivial contiguous subsequences with contiguous values).

What is the "real thing," anyway? Yui doesn't know either, but she knows how many correct permutations of length $n$ there are. Do you?

Yui might also not know if this $n$ is what she needs, so she hopes you can provide the number of correct permutations for lengths $1 \sim n$ respectively.

Note: A sequence is contiguous if and only if, after sorting the values of the sequence from smallest to largest, the $i$-th value is the $1$-st value plus $i-1$.

Input

The input file contains a single line with two integers $type$ and $n$, representing the data type and the maximum length of the permutation, respectively.

Output

For data with $type=0$, you need to output exactly one line containing a non-negative integer representing the number of correct permutations of length $n$ modulo $998\, 244\, 353$.

For data with $type=1$, you need to output $n$ lines, where the $i$-th line contains a non-negative integer representing the number of correct permutations of length $i$ modulo $998\, 244\, 353$.

Examples

Input 1

0 4

Output 1

2

Note 1

In the example, the correct permutations are $[2413], [3142]$.

Input 2

1 4

Output 2

1
2
0
2

Subtasks

This problem uses bundled testing.

For all data, $type \in \{0, 1\}, 1 \le n \le 10^5$.

Subtask ID $n \le$ $type \in$
$1$ $8$ $\{0, 1\}$
$2$ $1\,000$ $\{0, 1\}$
$3$ $10^5$ $\{0\}$
$4$ $10^5$ $\{0, 1\}$

Editorials

IDTypeStatusTitlePosted ByLast UpdatedActions
EditorialOpen Official EditorialQingyu- Download

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.