luogu#P4831. Scarlet loves WenHuaKe

    ID: 3772 远端评测题 1000ms 125MiB 尝试: 0 已通过: 0 难度: 8 上传者: 标签>多项式组合数学容斥原理生成函数洛谷月赛

Scarlet loves WenHuaKe

Background

Scarlet has started college. Before that, she worked hard on a Gaokao mock exam problem QAQ.

Problem Description

Scarlet tries to place 2×n2\times n cannons on an nn-row mm-column Chinese chessboard such that none of them can attack each other.

As everyone knows, Scarlet loves making trouble. She wants to ask how many valid configurations there are.

Input Format

One line with two integers, representing nn and mm.

Output Format

One integer, the number of configurations modulo 998244353998244353.

4 4
90

Hint

For 20%20\% of the testdata, n,m5n,m\leq5.

For another 25%25\% of the testdata, n,m2000n,m\leq2000.

For another 20%20\% of the testdata, n=mn=m.

For the remaining 35%35\% of the testdata, mn10m-n\leq10.

For 100%100\% of the testdata, 1nm1000001\leq n\leq m\leq100000.

Translated by ChatGPT 5