CF1784D.Wooden Spoon

提高+/省选-

通过率:0%

时间限制:4.00s

内存限制:512MB

AC君温馨提醒

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

题目描述

2n2^n people, numbered with distinct integers from 11 to 2n2^n, are playing in a single elimination tournament. The bracket of the tournament is a full binary tree of height nn with 2n2^n leaves.

When two players meet each other in a match, a player with the smaller number always wins. The winner of the tournament is the player who wins all nn their matches.

A virtual consolation prize "Wooden Spoon" is awarded to a player who satisfies the following nn conditions:

  • they lost their first match;
  • the player who beat them lost their second match;
  • the player who beat that player lost their third match;
  • …\ldots;
  • the player who beat the player from the previous condition lost the final match of the tournament.

It can be shown that there is always exactly one player who satisfies these conditions.

Consider all possible (2n)!(2^n)! arrangements of players into the tournament bracket. For each player, find the number of these arrangements in which they will be awarded the "Wooden Spoon", and print these numbers modulo 998 244 353998\,244\,353.

2n2^n 名选手,编号为从 11 到 2n2^n 的互不相同的整数,参加一场单败淘汰制锦标赛。该锦标赛的对阵表是一棵高度为 nn 的满二叉树,共有 2n2^n 个叶子节点。

当两名选手在一场比赛中相遇时,编号较小的选手总是获胜。锦标赛冠军是赢得全部 nn 场比赛的选手。

一个虚拟安慰奖“木勺奖”(Wooden Spoon)授予满足以下 nn 个条件的选手:

  • 他们在第一轮比赛中即告失利;
  • 击败他们的选手在第二轮比赛中失利;
  • 击败上一位选手的选手在第三轮比赛中失利;
  • …\ldots;
  • 满足前一条件的选手所击败的那位选手,在锦标赛的最后一场比赛(即第 nn 轮)中失利。

可以证明:总存在且仅存在一名选手满足上述所有条件。

考虑所有 (2n)!(2^n)! 种将选手安排进对阵表的方式。对每位选手,求出在这些安排中其获得“木勺奖”的方案数,并将这些数对 998 244 353998\,244\,353 取模后输出。

输入格式

The only line contains a single integer nn (1≤n≤201 \le n \le 20) — the size of the tournament.

There are 2020 tests in the problem: in the first test, n=1n = 1; in the second test, n=2n = 2; …\ldots; in the 2020-th test, n=20n = 20.

唯一的一行包含一个整数 nn(1≤n≤201 \le n \le 20)—— 表示锦标赛的规模。

本题共有 2020 个测试用例:第 11 个测试用例中,n=1n = 1;第 22 个测试用例中,n=2n = 2;…\ldots;第 2020 个测试用例中,n=20n = 20。

输出格式

Print 2n2^n integers — the number of arrangements in which the "Wooden Spoon" is awarded to players 1,2,…,2n1, 2, \ldots, 2^n, modulo 998 244 353998\,244\,353.

输出 2n2^n 个整数——分别表示将“木勺奖”授予选手 1,2,…,2n1, 2, \ldots, 2^n 的方案数(对 998 244 353998\,244\,353 取模)。

输入输出样例

  • 输入#1

    1

    输出#1

    0
    2
  • 输入#2

    2

    输出#2

    0
    0
    8
    16
  • 输入#3

    3

    输出#3

    0
    0
    0
    1536
    4224
    7680
    11520
    15360

说明/提示

In the first example, the "Wooden Spoon" is always awarded to player 22.

In the second example, there are 88 arrangements where players 11 and 44 meet each other in the first match, and in these cases, the "Wooden Spoon" is awarded to player 33. In the remaining 1616 arrangements, the "Wooden Spoon" is awarded to player 44.

在第一个例子中,“木勺奖”总是授予玩家 22。

在第二个例子中,有 88 种排列使得玩家 11 和 44 在第一场比赛中相遇;在这些情况下,“木勺奖”授予玩家 33。在其余 1616 种排列中,“木勺奖”授予玩家 44。

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

首页