#P7609. [THUPC 2021] 游戏
[THUPC 2021] 游戏
Description
Xiao C and Xiao W plan to play a two-player combinatorial game.
Xiao C has identical stones. Xiao W will split them into ordered piles. For the -th pile, the number of stones cannot exceed , but it is allowed to be .
Then Xiao C moves first, and they take turns making moves. Each move, a player may choose a non-empty pile and take away some stones from it (at least ). The player who cannot make a move loses.
As experienced competitive programmers, Xiao C and Xiao W already know the strategies for many games very well, so this time they want to do something different: they want to know how many ways of splitting the stones make Xiao C have a winning strategy.
Input Format
The first line contains two positive integers (, ).
The second line contains non-negative integers ().
Output Format
Output one non-negative integer, the number of valid ways modulo .
6 3
2 3 4
4
Hint
Sample Explanation
The following ways satisfy the requirement: , , , .
Source
From the 2021 Tsinghua University Student Programming Contest and Intercollegiate Invitational (THUPC2021).
Resources such as the editorial can be found at https://github.com/yylidiw/thupc_2/tree/master.
Translated by ChatGPT 5
京公网安备 11011102002149号