Rampant Growth
Time limit1sMemory limit2048 MB
Count the ways to place exactly one plant per column in an r by c grid so that plants in adjacent columns sit in different rows, modulo 998244353.
- Level
Easy2 of 10
- Topics
- Math, Combinatorics
- Solved
- No attempts yet
Problem
Eddy is planning his garden, which is a grid. He wants exactly one plant in each column. To keep the plants from competing for resources, plants in adjacent columns must be in different rows.
Count the number of ways Eddy can place plants in his garden under these conditions. Two ways differ if some square has a plant in one arrangement but not in the other. Output the count modulo .
Input
The single line of input contains two space-separated integers and (), where is the number of rows in Eddy's garden grid and is the number of columns.
Output
Output a single integer, the number of ways Eddy can place plants in his garden, modulo .