Problem p03066 - Generation 1

Orig Description

Score : 800 points
Problem StatementFind the number, modulo 998244353, of sequences of length N consisting of 0, 1 and 2 such that none of their contiguous subsequences totals to X.
Constraints
1 \leq N \leq 3000
1 \leq X \leq 2N
N and X are integers.
InputInput is given from Standard Input in the following format:
N X
OutputPrint the number, modulo 998244353, of sequences that satisfy the condition.
Sample Input 13 3
Sample Output 114
14 sequences satisfy the condition: (0,0,0),(0,0,1),(0,0,2),(0,1,0),(0,1,1),(0,2,0),(0,2,2),(1,0,0),(1,0,1),(1,1,0),(2,0,0),(2,0,2),(2,2,0) and (2,2,2).
Sample Input 28 6
Sample Output 21179
Sample Input 310 1
Sample Output 31024
Sample Input 49 13
Sample Output 418402
Sample Input 5314 159
Sample Output 5459765451

Extracted Specification

An integer N (1 ≤ N ≤ 3000), representing some quantity or size.
An integer X (1 ≤ X ≤ 2N).

### Example Input:

```
3 3
```

### Function Signature:
Write a function f(N, X) that takes in the input.
def f(N: int, X: int):
    ''' 
    N: an integer 
    X: an integer
    '''

Test Case Generator

Certainly! Here is a test case generator for the given problem statement:

```python
import random

def tcgen():
    N = random.randint(1, 3000)
    X = random.randint(1, 2 * N)
    return N, X

# Example of generating a test case
if __name__ == "__main__":
    N, X = tcgen()
    print(N, X)
```

This generator will produce random values for \( N \) and \( X \) within the given constraints:

- \( N \) is a random integer between 1 and 3000.
- \( X \) is a random integer between 1 and \( 2N \).

This ensures that the generated test cases are valid according to the problem constraints. If you want to run the generator and see an example output, you can use the provided snippet which will print \( N \) and \( X \).

Extract Arguments

def extract_arguments(fh):
    N, X = map(int, fh.readline().strip().split())
    return N, X