A15743 | Wooden Spoon
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
$2^n$ people, numbered with distinct integers from $1$ to $2^n$ , are playing in a single elimination tournament. The bracket of the tournament is a full binary tree of height $n$ with $2^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 $n$ their matches.
A virtual consolation prize "Wooden Spoon" is awarded to a player who satisfies the following $n$ 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 $(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\,353$ .
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 $n$ their matches.
A virtual consolation prize "Wooden Spoon" is awarded to a player who satisfies the following $n$ 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 $(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\,353$ .
输入格式
The only line contains a single integer $n$ ( $1 \le n \le 20$ ) — the size of the tournament.
There are $20$ tests in the problem: in the first test, $n = 1$ ; in the second test, $n = 2$ ; $\ldots$ ; in the $20$ -th test, $n = 20$ .
There are $20$ tests in the problem: in the first test, $n = 1$ ; in the second test, $n = 2$ ; $\ldots$ ; in the $20$ -th test, $n = 20$ .
输出格式
Print $2^n$ integers — the number of arrangements in which the "Wooden Spoon" is awarded to players $1, 2, \ldots, 2^n$ , modulo $998\,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 $2$ .
In the second example, there are $8$ arrangements where players $1$ and $4$ meet each other in the first match, and in these cases, the "Wooden Spoon" is awarded to player $3$ . In the remaining $16$ arrangements, the "Wooden Spoon" is awarded to player $4$ .
In the second example, there are $8$ arrangements where players $1$ and $4$ meet each other in the first match, and in these cases, the "Wooden Spoon" is awarded to player $3$ . In the remaining $16$ arrangements, the "Wooden Spoon" is awarded to player $4$ .
C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted