Mock CCC '23 1 S3 - Richard The Penguin

View as PDF

Submit solution

Points: 10 (partial)
Time limit: 0.25s
PyPy 3 0.5s
Memory limit: 1G

Problem type

Richard is a penguin who regularly commutes between Canada and the United States.

Specifically, Canada is at location 1, and the United States is at location N. In locations 2 through N1, there are ice blocks that Richard can jump on. Richard can jump from location i to location j if and only if |ij|K.

Richard does not believe in wasting time, so when he is commuting in one direction, he will always move in that direction. This means that when commuting from Canada to the United States, locations are monotonically increasing in number, and when commuting from the United States to Canada, locations are monotonically decreasing in number.

Richard's commute is complicated during the fall and spring when the ice is thawing between Canada and the United States. If Richard jumps on an ice block, that ice block will melt enough that it will not be usable on the return journey.

Count the number of distinct ways that Richard can do a round-trip commute from Canada to the United States and back. Two ways are distinct if, in some direction, Richard uses an ice block travelling in that direction in one way but not in the other way.

Constraints

2N5103

1K<N

In tests worth 1 mark, N50 and K2.

In tests worth an additional 2 marks, N50 and either K2 or K=N1.

In tests worth an additional 3 marks, N50.

In tests worth an additional 4 marks, N500.

In tests worth an additional 4 marks, N2500.

Input Specification

The first and only line contains two integers, N and K.

Output Specification

Let W be the number of ways Richard can commute. Output W modulo 998244353.

Sample Input

Copy
5 3

Sample Output

Copy
12

Comments

There are no comments at the moment.