AtCoder Grand Contest 073
A
Chords and Checkered
AtCoder
⌀ 2219
原题
←B →
翻译中…

Problem Statement

翻译中…

You are given integers $L, K$ and a length-$N$ non-negative integer sequence $A = (A_1, A_2, \ldots, A_N)$. Here, $2K < L$ and $0 \leq A_1 < A_2 < \cdots < A_N < L$ are guaranteed.

翻译中…

Consider a circle with circumference $L$. Take an arbitrary point on this circle as the reference point, and call the point reached by traveling clockwise distance $x$ along the circumference from there the point with coordinate $x$. Also, for each $i$ ($1 \leq i \leq N$), consider the chord connecting the point with coordinate $A_i$ and the point with coordinate $A_i + K$, and call this chord $i$.

翻译中…

For a set of chords $s$, the score is determined by the following procedure:

翻译中…
  • Draw all chords contained in $s$. The drawn chords divide the circle into several regions; color them with white and black. First, color the region containing the center of the circle white, and color the remaining regions so that adjacent regions (connected by a line segment of positive length) have different colors. It can be proved that such a coloring method always exists uniquely. The score is the number of regions colored black.
翻译中…

There are $2^N$ possible sets for $s$. Find the sum, modulo $998244353$, of scores for all of these.

翻译中…

Constraints

翻译中…
  • $1 \leq K$
  • $2K < L \leq 10^9$
  • $1 \leq N \leq 250000$
  • $0 \leq A_1 < A_2 < \cdots < A_N < L$
  • All input values are integers.
翻译中…

Input

翻译中…

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

翻译中…

L K N
A_1 A_2 \ldots A_N

翻译中…

Output

翻译中…

Output the answer.

翻译中…

样例

Input #1
5 2 2
0 1
Output #1
4
- When no chords are chosen, the score is $0$. - When chord $1$ is chosen, the score is $1$. - When chord $2$ is chosen, the score is $1$. - When chords $1, 2$ are chosen, the score is $2$. Therefore, the answer is $4$, which is the sum of these.
Input #2
3 1 1
2
Output #2
1
Input #3
5 2 5
0 1 2 3 4
Output #3
80
Input #4
7 3 3
0 2 3
Output #4
12
题目信息
题号
agc073_a
时间限制
2 s
内存限制
1024 MB

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