CF1709F.Multiset of Strings

省选/NOI-

通过率:0%

时间限制:6.00s

内存限制:512MB

AC君温馨提醒

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

题目描述

You are given three integers nn, kk and ff.

Consider all binary strings (i. e. all strings consisting of characters 00 and/or 11) of length from 11 to nn. For every such string ss, you need to choose an integer csc_s from 00 to kk.

A multiset of binary strings of length exactly nn is considered beautiful if for every binary string ss with length from 11 to nn, the number of strings in the multiset such that ss is their prefix is not exceeding csc_s.

For example, let n=2n = 2, c0=3c_{0} = 3, c00=1c_{00} = 1, c01=2c_{01} = 2, c1=1c_{1} = 1, c10=2c_{10} = 2, and c11=3c_{11} = 3. The multiset of strings 11,01,00,01{11, 01, 00, 01} is beautiful, since:

  • for the string 00, there are 33 strings in the multiset such that 00 is their prefix, and 3≤c03 \le c_0;
  • for the string 0000, there is one string in the multiset such that 0000 is its prefix, and 1≤c001 \le c_{00};
  • for the string 0101, there are 22 strings in the multiset such that 0101 is their prefix, and 2≤c012 \le c_{01};
  • for the string 11, there is one string in the multiset such that 11 is its prefix, and 1≤c11 \le c_1;
  • for the string 1010, there are 00 strings in the multiset such that 1010 is their prefix, and 0≤c100 \le c_{10};
  • for the string 1111, there is one string in the multiset such that 1111 is its prefix, and 1≤c111 \le c_{11}.

Now, for the problem itself. You have to calculate the number of ways to choose the integer csc_s for every binary string ss of length from 11 to nn in such a way that the maximum possible size of a beautiful multiset is exactly ff.

给你三个整数 nn、kk 和 ff。

考虑所有长度为 11 到 nn 的二进制字符串(即仅由字符 00 和/或 11 构成的字符串)。对每个这样的字符串 ss,你需要选择一个整数 csc_s,其取值范围为 00 到 kk(含端点)。

一个长度恰好为 nn 的二进制字符串多重集被称为优美的(beautiful),当且仅当:对每个长度为 11 到 nn 的二进制字符串 ss,该多重集中以 ss 为前缀的字符串个数不超过 csc_s。

例如,设 n=2n = 2,c0=3c_{0} = 3,c00=1c_{00} = 1,c01=2c_{01} = 2,c1=1c_{1} = 1,c10=2c_{10} = 2,c11=3c_{11} = 3。则多重集 {11,01,00,01}\{11, 01, 00, 01\} 是优美的,因为:

  • 对于字符串 00,多重集中有 33 个字符串以其为前缀,且 3≤c03 \le c_0;
  • 对于字符串 0000,多重集中有 11 个字符串以其为前缀,且 1≤c001 \le c_{00};
  • 对于字符串 0101,多重集中有 22 个字符串以其为前缀,且 2≤c012 \le c_{01};
  • 对于字符串 11,多重集中有 11 个字符串以其为前缀,且 1≤c11 \le c_1;
  • 对于字符串 1010,多重集中有 00 个字符串以其为前缀,且 0≤c100 \le c_{10};
  • 对于字符串 1111,多重集中有 11 个字符串以其为前缀,且 1≤c111 \le c_{11}。

现在,回到本题本身:你需要计算有多少种方式为每个长度为 11 到 nn 的二进制字符串 ss 选择整数 csc_s,使得优美多重集的最大可能大小恰好等于 ff。

输入格式

The only line of input contains three integers nn, kk and ff (1≤n≤151 \le n \le 15; 1≤k,f≤2⋅1051 \le k, f \le 2 \cdot 10^5).

输入仅有一行,包含三个整数 nn、kk 和 ff(1≤n≤151 \le n \le 15;1≤k,f≤2⋅1051 \le k, f \le 2 \cdot 10^5)。

输出格式

Print one integer — the number of ways to choose the integer csc_s for every binary string ss of length from 11 to nn in such a way that the maximum possible size of a beautiful multiset is exactly ff. Since it can be huge, print it modulo 998244353998244353.

输出一个整数——即为对每个长度从 11 到 nn 的二进制字符串 ss 选择整数 csc_s 的方案数,使得优美多重集的最大可能大小恰好为 ff。由于答案可能非常大,请对 998244353998244353 取模后输出。

输入输出样例

  • 输入#1

    1 42 2

    输出#1

    3
  • 输入#2

    2 37 13

    输出#2

    36871576
  • 输入#3

    4 1252 325

    输出#3

    861735572
  • 输入#4

    6 153 23699

    输出#4

    0
  • 输入#5

    15 200000 198756

    输出#5

    612404746

说明/提示

In the first example, the three ways to choose the integers csc_s are:

  • c0=0c_0 = 0, c1=2c_1 = 2, then the maximum beautiful multiset is 1,1{1, 1};
  • c0=1c_0 = 1, c1=1c_1 = 1, then the maximum beautiful multiset is 0,1{0, 1};
  • c0=2c_0 = 2, c1=0c_1 = 0, then the maximum beautiful multiset is 0,0{0, 0}.

在第一个例子中,选择整数 csc_s 的三种方式为:

  • c0=0c_0 = 0,c1=2c_1 = 2,此时最大的优美多重集为 1,1{1, 1};
  • c0=1c_0 = 1,c1=1c_1 = 1,此时最大的优美多重集为 0,1{0, 1};
  • c0=2c_0 = 2,c1=0c_1 = 0,此时最大的优美多重集为 0,0{0, 0}。

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

首页