CF1930E.2..3...4.... Wonderful! Wonderful!

提高+/省选-

通过率:0%

时间限制:3.00s

内存限制:256MB

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Stack has an array aa of length nn such that ai=ia_i = i for all ii (1≤i≤n1 \leq i \leq n). He will select a positive integer kk (1≤k≤⌊n−12⌋1 \leq k \leq \lfloor \frac{n-1}{2} \rfloor) and do the following operation on aa any number (possibly 00) of times.

  • Select a subsequence†^\dagger ss of length 2⋅k+12 \cdot k + 1 from aa. Now, he will delete the first kk elements of ss from aa. To keep things perfectly balanced (as all things should be), he will also delete the last kk elements of ss from aa.

Stack wonders how many arrays aa can he end up with for each kk (1≤k≤⌊n−12⌋1 \leq k \leq \lfloor \frac{n-1}{2} \rfloor). As Stack is weak at counting problems, he needs your help.

Since the number of arrays might be too large, please print it modulo 998 244 353998\,244\,353.

†^\dagger A sequence xx is a subsequence of a sequence yy if xx can be obtained from yy by deleting several (possibly, zero or all) elements. For example, [1,3][1, 3], [1,2,3][1, 2, 3] and [2,3][2, 3] are subsequences of [1,2,3][1, 2, 3]. On the other hand, [3,1][3, 1] and [2,1,3][2, 1, 3] are not subsequences of [1,2,3][1, 2, 3].

Stack 有一个长度为 nn 的数组 aa,满足对所有 ii(1≤i≤n1 \leq i \leq n)都有 ai=ia_i = i。他将选择一个正整数 kk(1≤k≤⌊n−12⌋1 \leq k \leq \lfloor \frac{n-1}{2} \rfloor),并对数组 aa 执行以下操作任意多次(可能为 00 次):

  • 从 aa 中选取一个长度为 2⋅k+12 \cdot k + 1 的子序列†^\dagger ss。接着,他将从 aa 中删除 ss 的前 kk 个元素;为保持完全平衡(正如万物本应如此),他还将从 aa 中删除 ss 的后 kk 个元素。

Stack 想知道:对每个 kk(1≤k≤⌊n−12⌋1 \leq k \leq \lfloor \frac{n-1}{2} \rfloor),最终能得到多少种不同的数组 aa?由于 Stack 不擅长计数问题,他需要你的帮助。

由于可能的数组数量过大,请将答案对 998 244 353998\,244\,353 取模后输出。

†^\dagger 序列 xx 是序列 yy 的一个子序列,当且仅当 xx 可通过从 yy 中删除若干个(可能为零个或全部)元素而得到。例如,[1,3][1, 3]、[1,2,3][1, 2, 3] 和 [2,3][2, 3] 都是 [1,2,3][1, 2, 3] 的子序列;而 [3,1][3, 1] 和 [2,1,3][2, 1, 3] 则不是 [1,2,3][1, 2, 3] 的子序列。

输入格式

Each test contains multiple test cases. The first line contains a single integer tt (1≤t≤2⋅1031 \leq t \leq 2 \cdot 10^3) — the number of test cases. The description of the test cases follows.

The first line of each test case contains a single integer nn (3≤n≤1063 \leq n \leq 10^6) — the length of the array aa.

It is guaranteed that the sum of nn over all test cases does not exceed 10610^6.

每个测试包含多个测试用例。第一行包含一个整数 tt(1≤t≤2⋅1031 \leq t \leq 2 \cdot 10^3),表示测试用例的数量。随后是各测试用例的描述。

每个测试用例的第一行包含一个整数 nn(3≤n≤1063 \leq n \leq 10^6),表示数组 aa 的长度。

保证所有测试用例的 nn 之和不超过 10610^6。

输出格式

For each test, on a new line, print ⌊n−12⌋\lfloor \frac{n-1}{2} \rfloor space-separated integers — the ii-th integer representing the number of arrays modulo 998 244 353998\,244\,353 that Stack can get if he selects k=ik=i.

对于每个测试用例,在新的一行中输出 ⌊n−12⌋\lfloor \frac{n-1}{2} \rfloor 个以空格分隔的整数——其中第 ii 个整数表示当 Stack 选择 k=ik=i 时,他能得到的不同数组的数目(对 998 244 353998\,244\,353 取模)。

输入输出样例

  • 输入#1

    4
    3
    4
    5
    10

    输出#1

    2 
    4 
    10 2 
    487 162 85 10

说明/提示

In the first test case, two aa are possible for k=1k=1:

  • [1,2,3][1,2,3];
  • [2][2].

In the second test case, four aa are possible for k=1k=1:

  • [1,2,3,4][1,2,3,4];
  • [1,3][1,3];
  • [2,3][2,3];
  • [2,4][2,4].

In the third test case, two aa are possible for k=2k=2:

  • [1,2,3,4,5][1,2,3,4,5];
  • [3][3].

在第一个测试用例中,当 k=1k=1 时,存在两个可能的数组 aa:

  • [1,2,3][1,2,3];
  • [2][2]。

在第二个测试用例中,当 k=1k=1 时,存在四个可能的数组 aa:

  • [1,2,3,4][1,2,3,4];
  • [1,3][1,3];
  • [2,3][2,3];
  • [2,4][2,4]。

在第三个测试用例中,当 k=2k=2 时,存在两个可能的数组 aa:

  • [1,2,3,4,5][1,2,3,4,5];
  • [3][3]。

输入解题思路,AI测评打分。不知道怎么写?

首页