#P10200. [湖北省选模拟 2024] 花神诞日 / sabzeruz

[湖北省选模拟 2024] 花神诞日 / sabzeruz

Background

Legend says that the reason this day is called “Flower Goddess’s Birthday” is that it originally meant “celebrating the Flower Goddess.”

A long, long time ago, the Tree King (Lady) had a birthday. Her friends held a banquet to celebrate it.

At the banquet, several gods got drunk. One of them, in high spirits, started playing an instrument. Then the Tree King began to sing, and the Flower Goddess started to dance.

As the Flower Goddess danced, countless beautiful Patishalan grew on the grass she stepped on...

Ah, if only time could stay at that moment forever.

Problem Description

You are preparing a banquet for the Flower Goddess’s Birthday. You have NN kinds of ingredients, numbered 1,2,,N1,2,\cdots,N in order. The flavor of ingredient ii is aia_i, and the flavors of any two ingredients are all different. You want to use these NN ingredients to make two dishes. Each ingredient must be used in exactly one dish. Each dish must use at least one ingredient.

In the same dish, the flavors of different ingredients will react pairwise. If ingredient ii reacts with ingredient jj, it produces a flavor of aiaja_i \oplus a_j, where \oplus denotes the XOR operation. The final flavor of a dish is the minimum among all flavors produced by these pairwise reactions. For example, if a dish uses three ingredients with flavors 2,3,42,3,4, then the pairwise reactions produce three flavors: 1(23)1(2 \oplus 3), 6(24)6(2 \oplus 4), and 7(34)7(3 \oplus 4). The flavor of this dish is min(1,6,7)=1\min(1,6,7)=1.

The “original” flavor is the most delicious. If a dish uses only one ingredient, then the flavor of this dish is ++\infty.

You want the flavor of the first dish to be at least k1k_1, and the flavor of the second dish to be at least k2k_2. How many different cooking plans are there?

Note: using the same set of ingredients but swapping which one is the first dish and which one is the second dish counts as two different plans. For example, “dish 1 uses ingredients 1,2,31,2,3 and dish 2 uses 4,54,5” and “dish 1 uses 4,54,5 and dish 2 uses 1,2,31,2,3” are considered two different plans.

Since the answer may be very large, you only need to output the answer modulo 109+710^9+7.

Input Format

The input has two lines.

The first line contains three positive integers N,k1,k2N,k_1,k_2, representing the number of ingredient types, and the required flavor thresholds for the first and second dish.

The second line contains NN positive integers a1,a2,,aNa_1,a_2,\cdots,a_N, where aia_i is the flavor of ingredient ii.

Output Format

Output one line with one integer, representing the number of cooking plans modulo 109+710^9+7.

2 10 10
1 2
2
4 2 5
5 3 1 4
5
见选手目录下的 sabzeruz/sabzeruz3.in 与 sabzeruz/sabzeruz3.ans。
该样例符合测试点 9 ∼ 11 的限制。
见选手目录下的 sabzeruz/sabzeruz4.in 与 sabzeruz/sabzeruz4.ans。
该样例符合测试点 12 ∼ 15 的限制。
见选手目录下的 sabzeruz/sabzeruz5.in 与 sabzeruz/sabzeruz5.ans。

Hint

Sample Explanation 2

The five cooking plans are listed below:

  • Dish 1 uses ingredients 1,2,31,2,3, and dish 2 uses ingredient 44.
  • Dish 1 uses ingredients 1,21,2, and dish 2 uses ingredients 3,43,4.
  • Dish 1 uses ingredients 1,31,3, and dish 2 uses ingredients 2,42,4.
  • Dish 1 uses ingredients 2,3,42,3,4, and dish 2 uses ingredient 11.
  • Dish 1 uses ingredients 3,43,4, and dish 2 uses ingredients 1,21,2.

Subtasks

For all testdata, it is guaranteed that 1N2×1051 \le N \le 2\times 10^5, 1k1,k2,ai<2601 \le k_1,k_2,a_i <2^{60}. For any 1i<jN1 \le i<j \le N, aiaja_i \neq a_j.

Test Point ID NN\le Special Property
11 1818 None
232\sim 3 5×1035\times 10^3 A
484\sim 8 None
9119\sim 11 2×1052\times 10^5 A
121512\sim 15 B
162516\sim 25 None

Special Property A: it is guaranteed that k1=k2k_1=k_2.

Special Property B: it is guaranteed that k1=1k_1=1.

Translated by ChatGPT 5