CF1580F.Problems for Codeforces

普及/提高-

通过率:0%

AC君温馨提醒

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

题目描述

XYMXYM and CQXYM will prepare nn problems for Codeforces. The difficulty of the problem ii will be an integer aia_i , where ai0a_i \geq 0 . The difficulty of the problems must satisfy ai+ai+1<ma_i+a_{i+1}<m ( 1i<n1 \leq i < n ), and a1+an<ma_1+a_n<m , where mm is a fixed integer. XYMXYM wants to know how many plans of the difficulty of the problems there are modulo 998244353998\,244\,353 .

Two plans of difficulty aa and bb are different only if there is an integer ii ( 1in1 \leq i \leq n ) satisfying aibia_i \neq b_i .

输入格式

A single line contains two integers nn and mm ( 2n500002 \leq n \leq 50\,000 , 1m1091 \leq m \leq 10^9 ).

输出格式

Print a single integer — the number of different plans.

输入输出样例

  • 输入#1

    3 2

    输出#1

    4
  • 输入#2

    5 9

    输出#2

    8105
  • 输入#3

    21038 3942834

    输出#3

    338529212

说明/提示

In the first test case, the valid aa are: [0,0,0][0,0,0] , [0,0,1][0,0,1] , [0,1,0][0,1,0] , [1,0,0][1,0,0] .

[1,0,1][1,0,1] is invalid since a1+anma_1+a_n \geq m .

首页