Logo
(追記) (追記ここまで)

18956번 - Little Q and Big Integers 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1.5 초 512 MB307728.000%

문제

Little Q likes positive big integers in base $k$ notation, but not all of them. He doesn't like integers with zeroes, including leading zeroes. Additionally, he is particular about the number of occurrences of each digit. Formally, his preferences can be described as a binary matrix $g_{1 .. k - 1, 0 .. n},ドル where for every digit $i$ from 1ドル$ to $k - 1,ドル if $g_{i, j} = 0,ドル he doesn't like integers which contain exactly $j$ copies of digit $i$. He also can't accept any digit appearing more than $n$ times. The integer must contain at least one digit.

Little Q's taste changes every day. There are $m$ days in total, and on day $i,ドル the value $g_{u_i, v_i}$ is flipped (0ドル$ becomes 1ドル$ and 1ドル$ becomes 0ドル$). Let $\mathrm{cnt} (i)$ denote the number of big integers which Little Q likes after $i$-th day's change, and $\mathrm{cnt} (0)$ denote the answer before all changes. Your task is to calculate the following:

$$\left( \sum_{i = 0}^{m} \mathrm{cnt} (i) \right) \bmod 786,433円\text{.}$$

입력

The first line of the input contains three integers $k,ドル $n$ and $m$: the base, the upper limit and the number of days (3ドル \leq k \leq 10,ドル 1ドル \leq n \leq 1.4 \cdot 10^4,ドル 1ドル \leq m \leq 200$).

In the next $k - 1$ lines, line $i$ contains $n + 1$ integers $g_{i, 0},ドル $g_{i, 1},ドル $\ldots,ドル $g_{i, n}$ (0ドル \leq g_{i, j} \leq 1$). Together they provide the initial matrix $g$.

After that follow $m$ lines, $i$-th line contains two integers $u_i$ and $v_i$ which mean that on $i$-th day, the value $g_{u_i, v_i}$ is flipped (1ドル \leq u_i \leq k - 1,ドル 0ドル \leq v_i \leq n$).

출력

Print a single line with a single integer: the answer to the problem.

제한

예제 입력 1

3 2 2
101
010
1 1
1 2

예제 출력 1

13

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2017 > Day 1: Songyang Chen Contest 1 A번

(追記) (追記ここまで)

출처

대학교 대회

  • 사업자 등록 번호: 541-88-00682
  • 대표자명: 최백준
  • 주소: 서울시 서초구 서초대로74길 29 서초파라곤 412호
  • 전화번호: 02-521-0487 (이메일로 연락 주세요)
  • 이메일: contacts@startlink.io
  • 통신판매신고번호: 제 2017-서울서초-2193 호

AltStyle によって変換されたページ (->オリジナル) /