#P6811. 「MCOI-02」Build Battle 建筑大师
「MCOI-02」Build Battle 建筑大师
Background
WAPER loves playing Hypixel (the world’s largest Minecraft minigame server) Build Battle!
Hint: In this problem, wool is considered a type of block.
Problem Description
Now WAPER is going to play rounds of Build Battle. At the beginning of the -th round, WAPER chooses a parameter , and places colored wool blocks in order. The color sequence is:
$$1,\ 2,\ ...\ ,\ m_i-1,\ m_i,\ 1,\ 2,\ ...\ ,m_i-1\ ,m_i\ ,\ ...\ (n-1) \ \bmod \ m_i+1$$For example, when , the color sequence is:
Now WAPER is going to break some blocks (he may break none, or break all). WAPER wants to know how many different color sequences can be produced this way. (Two color sequences are different if and only if their lengths are different, or the wool color at some position is different.)
Because the answer is too large, output the result modulo .
(In fact, this asks for the number of essentially different subsequences of this sequence, modulo .)
Input Format
The first line contains two integers and , representing the number of wool blocks and the number of rounds.
The second line contains integers , representing the parameters.
Output Format
Output lines, each containing one integer representing the answer.
Output the answer modulo .
10 6
1 1 4 5 1 4
11
11
833
944
11
833
1000000 1
114514
945636198
Hint
Constraints and Notes
This problem uses bundled testdata.
- Subtask 1 (5 pts): , .
- Subtask 2 (15 pts): , .
- Subtask 3 (15 pts): , .
- Subtask 4 (25 pts): .
- Subtask 5 (40 pts): No special constraints.
For of the testdata, , .
Additional Information
Minecraft OI Round 2 B
- Maker: WAPER420.
- Tester: 灵空 (Lingkong).
$The sample was not written by the problem setter!!!!!!!!!!!!!!!!!$
Translated by ChatGPT 5