No.2683 Two Sheets
Problem Statement
There is a grid with $H$ rows and $W$ columns. The cell in the $i$-th row from the top and the $j$-th column from the left is called $(i,j)$. Initially, no cell is painted black. Takahashi will now repeat the following operation $2$ times.
- Choose an integer $x$ between $1$ and $H-A+1$, inclusive, and an integer $y$ between $1$ and $W-B+1$, inclusive, independently and uniformly at random, and paint black the rectangular region of $A$ rows and $B$ columns whose top-left cell is $(x,y)$.
Find the expected value, $\rm{mod}\ 998244353$, of the number of cells painted black after Takahashi finishes the $2$ operations.
Definition of a rational number $\rm{mod}\ 998244353$
It can be proved that, under the constraints of this problem, the expected value to be found is always a rational number. Moreover, when this expected value is expressed as an irreducible fraction using coprime positive integers $P$, $Q$ as $P/Q$, it can be shown that $Q$ is not divisible by $998244353$, and that an integer satisfying $P \equiv Q \times R \mod 998244353$, at least $0$ and less than $998244353$, is uniquely determined as $R$. Find this $R$.
Input
$H\ W\ A\ B$
- All input values are integers.
- $1\leq A\leq H \leq 2 \times 10^5$
- $1\leq B\leq W \leq 2 \times 10^5$
Output
Print the answer as an integer on one line, followed by a newline.
Sample
Sample 1
Input
2 3 1 2
Output
748683268
For example, if $x=1, y=1$ is chosen in the 1st operation and $x=1, y=2$ is chosen in the 2nd operation, the cells painted black are the 3 cells $(1,1), (1,2), (1,3)$.
It can be shown that the expected number of cells painted black is $13/4$.
Sample 2
Input
1 1 1 1
Output
1
Sample 3
Input
13223 2930 50 222
Output
371659179
提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。
arad
tute7627
SPD_9X2
だれ
kemuniku
kyawa