A11082 | Days of Floral Colours
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
The Floral Clock has been standing by the side of Mirror Lake for years. Though unable to keep time, it reminds people of the passage of time and the good old days.
On the rim of the Floral Clock are $2n$ flowers, numbered from $1$ to $2n$ clockwise, each of which has a colour among all $n$ possible ones. For each colour, there are exactly two flowers with it, the distance between which either is less than or equal to $2$ , or equals $n$ . Additionally, if flowers $u$ and $v$ are of the same colour, then flowers opposite to $u$ and opposite to $v$ should be of the same colour as well — symmetry is beautiful!
Formally, the distance between two flowers is $1$ plus the number of flowers on the minor arc (or semicircle) between them. Below is a possible arrangement with $n=6$ that cover all possibilities.
The beauty of an arrangement is defined to be the product of the lengths of flower segments separated by all opposite flowers of the same colour. In other words, in order to compute the beauty, we remove from the circle all flowers that have the same colour as flowers opposite to them. Then, the beauty is the product of lengths of all remaining segments. Note that we include segments of length $0$ in this product. If there are no flowers that have the same colour as flower opposite to them, the beauty equals $0$ . For instance, the beauty of the above arrangement equals $1×3×1×3=9$ — the segments are ${2}$ , ${4,5,6}$ , ${8}$ and ${10,11,12}$ .
While keeping the constraints satisfied, there may be lots of different arrangements. Find out the sum of beauty over all possible arrangements, modulo $998244353$ . Two arrangements are considered different, if a pair $(u,v)$ ( $1<=u,v<=2n$ ) exists such that flowers $u$ and $v$ are of the same colour in one of them, but not in the other.
On the rim of the Floral Clock are $2n$ flowers, numbered from $1$ to $2n$ clockwise, each of which has a colour among all $n$ possible ones. For each colour, there are exactly two flowers with it, the distance between which either is less than or equal to $2$ , or equals $n$ . Additionally, if flowers $u$ and $v$ are of the same colour, then flowers opposite to $u$ and opposite to $v$ should be of the same colour as well — symmetry is beautiful!
Formally, the distance between two flowers is $1$ plus the number of flowers on the minor arc (or semicircle) between them. Below is a possible arrangement with $n=6$ that cover all possibilities.
The beauty of an arrangement is defined to be the product of the lengths of flower segments separated by all opposite flowers of the same colour. In other words, in order to compute the beauty, we remove from the circle all flowers that have the same colour as flowers opposite to them. Then, the beauty is the product of lengths of all remaining segments. Note that we include segments of length $0$ in this product. If there are no flowers that have the same colour as flower opposite to them, the beauty equals $0$ . For instance, the beauty of the above arrangement equals $1×3×1×3=9$ — the segments are ${2}$ , ${4,5,6}$ , ${8}$ and ${10,11,12}$ .
While keeping the constraints satisfied, there may be lots of different arrangements. Find out the sum of beauty over all possible arrangements, modulo $998244353$ . Two arrangements are considered different, if a pair $(u,v)$ ( $1<=u,v<=2n$ ) exists such that flowers $u$ and $v$ are of the same colour in one of them, but not in the other.
输入格式
The first and only line of input contains a lonely positive integer $n$ ( $3<=n<=50000$ ) — the number of colours present on the Floral Clock.
输出格式
Output one integer — the sum of beauty over all possible arrangements of flowers, modulo $998244353$ .
输入输出样例
输入 #1
3
输出 #1
24
输入 #2
4
输出 #2
4
输入 #3
7
输出 #3
1316
输入 #4
15
输出 #4
3436404
With $n=3$ , the following six arrangements each have a beauty of $2×2=4$ .
While many others, such as the left one in the figure below, have a beauty of $0$ . The right one is invalid, since it's asymmetric.

While many others, such as the left one in the figure below, have a beauty of $0$ . The right one is invalid, since it's asymmetric.

C++ 编辑器
输入
输出
可保存默认模板;新题优先使用已保存模板。
当前快捷键仅展示,暂不支持修改。
- 撤销
Ctrl / ⌘ + Z - 重做
Ctrl / ⌘ + Y - 查找
Ctrl / ⌘ + F - 全选
Ctrl / ⌘ + A - 复制
Ctrl / ⌘ + C - 剪切
Ctrl / ⌘ + X - 粘贴
Ctrl / ⌘ + V - 自动排版
工具栏排版按钮 - 草稿保存
编辑时自动保存到本机
历史
提交记录
状态说明时间源码
AI
作答助手
你好,我是作答助手。可以问思路、复杂度、样例含义或代码报错原因;不会直接给出完整 AC 代码。
确定要清空代码吗?
提交通过
评测结果:Accepted