#P13606. [NWRRC 2022] IQ Game
[NWRRC 2022] IQ Game
题目描述
A popular TV show "Kak? Zachem? Pochemu?" highlights a team of six players working together to solve challenging questions. Players sit around a circular table divided into sectors numbered clockwise from to . At the start of the game, each sector contains an envelope with a question to be answered.
Each round, the spinning top at the center of the table chooses a sector of the table uniformly at random. If the chosen sector contains an envelope, the host opens it and reads the question inside. If there is no envelope in the chosen sector, the host opens the next envelope in the clockwise direction from the chosen sector instead. After the round, the opened envelope is removed from the table.
Tonight, the audience's favorite team is playing. They have already played rounds out of , so there are envelopes remaining on the table. Things are not looking good for the team --- one more incorrect answer will send them home. One of the questions is a special, notoriously hard question called "Hyperblitz". The team is confident they can answer each of the remaining questions except "Hyperblitz". Find the expected number of rounds they will play, modulo (see the Output section for details).
输入格式
The first line contains three integers , , and --- the total number of sectors, the number of remaining questions, and the sector containing the "Hyperblitz" question (; ; ). It is guaranteed that is not equal to .
The second line contains distinct integers --- the numbers of sectors that still have envelopes, in clockwise order ().
There is exactly one index with .
输出格式
Print a single integer --- the expected number of rounds the team will play (including the inevitable "Hyperblitz"), modulo .
Formally, let . It can be shown that the expected number of rounds can be expressed as an irreducible fraction , where and are integers and . Print the integer equal to . In other words, print such an integer that and .
3 2 3
2 3
665496237
6 3 4
1 2 4
582309208
8 8 5
1 2 3 4 5 6 7 8
499122181
提示
In the first example test, in the first round, the team plays the "Hyperblitz" with probability , so with probability they play 1 round, and with probability they play 2 rounds. The expected number of rounds is .
As , the correct output is $5 \cdot 332\,748\,118 \bmod {998\,244\,353} = 665\,496\,237$.