CF869C.The Intriguing Obsession

普及+/提高

通过率:0%

时间限制:1.00s

内存限制:256MB

AC君温馨提醒

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

题目描述

— 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 998 244 353. 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.

——这可不是玩耍,而是作为正义盟友的职责,哥哥!

——不是盟友,而是正义本身,姐姐!

手牵着手,以超越我们思维的速度奔向四方!这一次,火焰姐妹——Karen 和 Tsukihi——将前往她们从未抵达过的地方——被水域环绕的岛屿!

共有三簇岛屿, conveniently 地分别染成红色、蓝色和紫色。这三簇岛屿各自包含 aa、bb 和 cc 个互不相同的岛屿。

一些(可能全部,也可能一个都没有)桥梁已在部分岛屿之间建成。每座桥梁为双向连接,连接两个不同的岛屿,且长度为 11。对于任意两个同色岛屿,它们之间要么无法通过桥梁互相到达,要么其最短距离至少为 33——显然,这是为了防止异象在簇内快速蔓延。

火焰姐妹已为未知做好准备,但她们也想考验你的勇气。而你,就负责算出在上述约束下,所有可能的建桥方案总数,并将答案对 998 244 353998\,244\,353 取模后给出。若存在一对岛屿,在一种方案中有桥相连、而在另一种方案中没有,则认为这两种方案不同。

输入格式

The first and only line of input contains three space-separated integers a, b and c (1 ≤ a, b, c ≤ 5 000) — the number of islands in the red, blue and purple clusters, respectively.

输入仅有一行,包含三个用空格分隔的整数 aa、bb 和 cc(1 ≤ a, b, c ≤ 5 0001 ≤ a, b, c ≤ 5\,000),分别表示红色、蓝色和紫色群岛中的岛屿数量。

输出格式

Output one line containing an integer — the number of different ways to build bridges, modulo 998 244 353.

输出一行,包含一个整数——建造桥梁的不同方案数对 998 244 353 取模的结果。

输入输出样例

  • 输入#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 23 = 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.

在第一个例子中,共有 3 座桥可能被建造,且任意桥的搭建方案均不违反限制条件。因此答案为 23=82^3 = 8。

在第二个例子中,下图中上方的两个结构是合法方案的实例,而下方的两个结构则分别因蓝色和紫色连通块而不合法。

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

首页