AtCoder Regular Contest 190 (Div. 1)
B
L Partition
AtCoder
⌀ 2273
原题
← AC →
翻译中…

Problem Statement

翻译中…

There is an $N \times N$ grid. Let $(i,j)$ denote the cell at the $i$-th row from the top and the $j$-th column from the left.

翻译中…

For $K = 1, 2, \ldots, N$, a level $K$ L-shape is a set of $2K - 1$ cells that satisfies at least one of the following four conditions:

翻译中…
  • All cells reachable from a certain cell $(i,j)$ by moving down or right between $0$ and $K-1$ cells, inclusive (where $1 \leq i \leq N-K+1$, $1 \leq j \leq N-K+1$).
  • All cells reachable from a certain cell $(i,j)$ by moving down or left between $0$ and $K-1$ cells, inclusive (where $1 \leq i \leq N-K+1$, $K \leq j \leq N$).
  • All cells reachable from a certain cell $(i,j)$ by moving up or right between $0$ and $K-1$ cells, inclusive (where $K \leq i \leq N$, $1 \leq j \leq N-K+1$).
  • All cells reachable from a certain cell $(i,j)$ by moving up or left between $0$ and $K-1$ cells, inclusive (where $K \leq i \leq N$, $K \leq j \leq N$).
翻译中…

You are given a cell $(a,b)$ and $Q$ queries $k_1, \ldots, k_Q$.

翻译中…

For each $i$, print the number, modulo $998244353$, of ways to partition the entire grid into exactly one level $1$ L-shape, one level $2$ L-shape, $\ldots$, and one level $N$ L-shape so that cell $(a,b)$ is contained in the level $k_i$ L-shape.

翻译中…

Constraints

翻译中…
  • $1 \leq N \leq 10^7$
  • $1 \leq a \leq N$
  • $1 \leq b \leq N$
  • $1 \leq Q \leq \min\lbrace N, 200000 \rbrace$
  • $1 \leq k_1 < \cdots < k_Q \leq N$
  • All input values are integers.
翻译中…

Input

翻译中…

The input is given from Standard Input in the following format:

翻译中…

N a b
Q
k_1 \cdots k_Q

翻译中…

Output

翻译中…

Print $Q$ lines.

翻译中…

The $i$-th line should contain the number, modulo $998244353$, of ways to partition the grid into exactly one level $1$ L-shape, one level $2$ L-shape, $\ldots$, and one level $N$ L-shape so that cell $(a,b)$ is contained in the level $k_i$ L-shape.

翻译中…

样例

Input #1
3 1 2
1
2
Output #1
6
The six ways shown in the following figure are the solutions. In the figure, an integer $k$ in a cell means that the cell belongs to the level $k$ L-shape. ![image](https://img.atcoder.jp/arc190/d853bd693f0d3848c725803512dc382a.png)
Input #2
5 2 5
3
1 3 5
Output #2
4
32
128
Input #3
100 50 50
4
1 10 50 100
Output #3
934228871
758172260
444239843
0
题目信息
题号
arc190_b
时间限制
2 s
内存限制
1024 MB

题面与样例版权归 AtCoder 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。