| 시간 제한 | 메모리 제한 | 제출 | 정답 | 맞힌 사람 | 정답 비율 |
|---|---|---|---|---|---|
| 3 초 | 2048 MB | 3 | 3 | 2 | 100.000% |
Let us consider the following operations on bitsets of size $m$:
You are given an array of bitsets $s_1, s_2, \ldots, s_n$. Write a program that can answer $k$ queries of the following form:
The first line contains two integers $n$ and $m$ (1ドル \leq n, m \leq 10^5$; $n \cdot m \leq 10^6$). The following $n$ lines describe the $n$ bitsets, where each line consists of $m$ characters 0ドル$ and 1ドル$ representing the bits of that bitset.
The next line of the input contains a single integer $k$ (1ドル \leq k \leq 2 \cdot 10^7$), which denotes the number of queries. The following line contains three integers $x,ドル $y,ドル and $z$ (1ドル \leq x, y, z \leq 10^9$).
The queries are generated using pseudo-random numbers, with input parameters $x,ドル $y,ドル and $z,ドル and a sequence $q_1, q_2, \ldots, q_{k - 1}$ of answers to the queries. Define two sequences $a$ and $b$ as follows:
For each query $i,ドル the parameters $\ell$ and $r$ are defined as $\ell=\min(a_i, b_i)$ and $r=\max(a_i, b_i)$.
Output a single integer: the sum of the answers for all queries.
4 10 1010110101 0101111001 1101101101 1011010000 4 10 5 4
9
The queries are listed below:
| # | $\ell$ | $r$ | answer |
|---|---|---|---|
| 1 | 1ドル$ | 4ドル$ | 1ドル$ |
| 2 | 3ドル$ | 4ドル$ | 3ドル$ |
| 3 | 2ドル$ | 4ドル$ | 2ドル$ |
| 4 | 1ドル$ | 3ドル$ | 3ドル$ |