QOJ.ac

QOJ

Time Limit: 1 s Memory Limit: 256 MB Total points: 100

#3543. Losowy XOR

Statistics

Dana jest tablica $a$ zawierająca $n$ liczb całkowitych. Istnieje również początkowo pusta tablica $b$. Niektóre elementy tablicy $a$ zostaną dodane do $b$. Każdy element jest dodawany z prawdopodobieństwem $P$, niezależnie od pozostałych. Następnie obliczana jest wartość $s$:

$$ s = \bigoplus_{i=0}^{|b|} b_i $$

gdzie $\oplus$ oznacza bitową alternatywę wykluczającą (jeśli tablica $b$ jest pusta, $s$ jest równe zeru). Należy obliczyć wartość oczekiwaną $s^2$.

Wejście

Pierwszy wiersz wejścia zawiera trzy liczby całkowite $n$, $X$ i $Y$. Prawdopodobieństwo $P$ jest równe $\frac{X}{Y}$.

Drugi wiersz zawiera $n$ liczb całkowitych $a_i$ oddzielonych spacjami — elementy tablicy $a$.

$$ 1 \le n \le 10^5 $$

$$ 0 \le X < 10^9 + 7 $$

$$ 0 < Y < 10^9 + 7 $$

$$ X \le Y $$

$$ 0 \le a_i < 10^9 + 7 $$

Wyjście

Odpowiedź można zawsze przedstawić jako ułamek $\frac{u}{v}$, gdzie $u$ i $v$ są względnie pierwsze oraz $v \not\equiv 0 \pmod{10^9+7}$. Należy wypisać tylko jedną liczbę — $u \times v^{-1} \bmod (10^9+7)$.

Przykład

Wejście 1

3 1 2
2 8 10

Wyjście 1

42

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.