A11193 | The Intriguing Obsession
时间限制1s
内存限制256MB
通过 / 提交0/0
题目描述
— This is not playing but duty as allies of justice, Nii-chan!
— Not allies but justice itself, Onii-chan!
With hands joined, go everywhere at a speed faster than our thoughts! This time, the Fire Sisters — Karen and Tsukihi — is heading for somewhere they've never reached — water-surrounded islands!
There are three clusters of islands, conveniently coloured red, blue and purple. The clusters consist of $a$ , $b$ and $c$ distinct islands respectively.
Bridges have been built between some (possibly all or none) of the islands. A bridge bidirectionally connects two different islands and has length $1$ . For any two islands of the same colour, either they shouldn't be reached from each other through bridges, or the shortest distance between them is at least $3$ , apparently in order to prevent oddities from spreading quickly inside a cluster.
The Fire Sisters are ready for the unknown, but they'd also like to test your courage. And you're here to figure out the number of different ways to build all bridges under the constraints, and give the answer modulo $998244353$ . Two ways are considered different if a pair of islands exist, such that there's a bridge between them in one of them, but not in the other.
— Not allies but justice itself, Onii-chan!
With hands joined, go everywhere at a speed faster than our thoughts! This time, the Fire Sisters — Karen and Tsukihi — is heading for somewhere they've never reached — water-surrounded islands!
There are three clusters of islands, conveniently coloured red, blue and purple. The clusters consist of $a$ , $b$ and $c$ distinct islands respectively.
Bridges have been built between some (possibly all or none) of the islands. A bridge bidirectionally connects two different islands and has length $1$ . For any two islands of the same colour, either they shouldn't be reached from each other through bridges, or the shortest distance between them is at least $3$ , apparently in order to prevent oddities from spreading quickly inside a cluster.
The Fire Sisters are ready for the unknown, but they'd also like to test your courage. And you're here to figure out the number of different ways to build all bridges under the constraints, and give the answer modulo $998244353$ . Two ways are considered different if a pair of islands exist, such that there's a bridge between them in one of them, but not in the other.
输入格式
The first and only line of input contains three space-separated integers $a$ , $b$ and $c$ ( $1<=a,b,c<=5000$ ) — the number of islands in the red, blue and purple clusters, respectively.
输出格式
Output one line containing an integer — the number of different ways to build bridges, modulo $998244353$ .
输入输出样例
输入 #1
1 1 1
输出 #1
8
输入 #2
1 2 2
输出 #2
63
输入 #3
1 3 5
输出 #3
3264
输入 #4
6 2 9
输出 #4
813023575
In the first example, there are $3$ bridges that can possibly be built, and no setup of bridges violates the restrictions. Thus the answer is $2^{3}=8$ .
In the second example, the upper two structures in the figure below are instances of valid ones, while the lower two are invalid due to the blue and purple clusters, respectively.

In the second example, the upper two structures in the figure below are instances of valid ones, while the lower two are invalid due to the blue and purple clusters, respectively.

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