#P9537. [YsOI2023] Qingshan and Daniel 2
[YsOI2023] Qingshan and Daniel 2
Background
A game theory problem for Ysuperman’s template test.
What era is it now? People are still playing traditional symmetric games. Come and try a non-traditional asymmetric game.
Guess what the title means. That’s right: it is telling you to go do CF1764B!!! Also, this problem mixes memes from CF1495, CF1707, and CF1764.
Problem Description
Today, Ysuperman discovered an asymmetric game called Bugaboo. The rules are as follows:
At the beginning of the game, Qingshan has a set of positive integers, and Daniel has a set of positive integers.
Qingshan and Daniel take turns performing the following operation (Qingshan moves first): choose any two different numbers from your own set, and it must also satisfy that does not belong to the other player’s set. Then add into the other player’s set. The player who cannot make a move loses.
Note that during the game, a player’s set will keep changing. When choosing , the player may choose numbers originally in their set, or numbers added later.
Now Ysuperman gives you a set of positive integers. Ysuperman wants to know: if Qingshan’s initial set can be any of the subsets of , and Daniel’s initial set can also be any of the subsets of , then in how many cases will Qingshan win.
Since the answer may be very large, you only need to output the result modulo .
Input Format
The first line contains an integer , which is the size of set .
The next line contains integers , representing all numbers in set .
Output Format
Output one line with one number, representing the answer modulo .
3
1 2 3
15
5
6 8 10 17 19
378
9
2 3 4 6 7 8 12 16 18
106533
Hint
Explanation for Sample 1
For the first sample, it is clear that a necessary condition for Qingshan to win is that her initial set contains at least two numbers:
- When , Qingshan wins when .
- When , Qingshan wins when .
- When , Qingshan wins when .
- When , Qingshan wins when .
So the answer is .
Constraints
For of the testdata, .
For of the testdata, .
For of the testdata, .
For of the testdata, .
For of the testdata, , .
Translated by ChatGPT 5