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

33383번 - Digit DP 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
5 초 2048 MB222100.000%

문제

There are 2ドル^n$ machines in a factory, numbered from 0ドル$ to 2ドル^n-1$. The $i$-th machine consumes $p_i$ units of power. The factory uses a system called Digit Dynamic Powering (Digit DP) to control the power the machines consume.

Initially, an array $a_0, \ldots, a_{n-1}$ is given. Then the system would set the initial $p_i$ to $\sum\limits_{j \in S_i}{a_j},ドル where $S_i$ is the set of 1ドル$ bits in the binary representation of $i$.

After that, there may be some modifications, each modification would be adding a certain value to the power of some machines that form an interval. Formally speaking, you would be given three integers $\ell,ドル $r,ドル $x,ドル meaning that the power consumed by each of the machines numbered between $\ell$ and $r$ (inclusively) should increase by $x$. The endpoints of the intervals would be given as $n$-digit binary strings.

When some three distinct machines are used to produce a product, the product's price should always be the product of the $p_i$'s of those machines.

During these modifications, the manager may ask some questions about some intervals. What is the sum of the prices if we try every possible combination of three distinct machines in the interval to produce a product?

Formally speaking, you would be given two integers $\ell,ドル $r,ドル meaning that you should report the sum of the products $p_i \cdot p_j \cdot p_k$ of all triples $(i,j,k)$ satisfying $\ell \leq i < j < k \leq r$. As the answer may be rather large, find it modulo 998ドル,244円,353円$. The endpoints of the intervals would also be given as $n$-digit binary strings.

입력

The first line contains two integers $n$ and $q$ (1ドル \leq n \leq 100$; 1ドル \leq q \leq 5 \cdot 10^4$).

The second line contains the integer array $a_0, a_1, \ldots, a_{n-1}$ (0ドル \leq a_i \leq 10^9$).

The next $q$ lines contain queries. On each line, the first integer $t$ indicates the type of the query.

If $t = 1,ドル three integers $\ell,ドル $r,ドル $x$ follow (0ドル \leq \ell \leq r < 2^n,ドル 0ドル \leq x \leq 10^9$).

If $t = 2,ドル two integers $\ell,ドル $r$ follow (0ドル \leq \ell \leq r < 2^n$).

Note that $\ell$ and $r$ are given in $n$-bit binary string format, and the leftmost bit is the highest bit.

출력

For each query of type 2ドル,ドル print a line with a single integer: the answer modulo 998ドル,244円,353円$.

제한

예제 입력 1

3 3
1 2 4
2 000 111
1 010 101 1
2 000 111

예제 출력 1

1960
3040

예제 입력 2

2 2
1 1
2 00 10
2 00 11

예제 출력 2

0
2

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2023 > Day 6: olmrgcsi And His Friends’ Contest D번

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

출처

대학교 대회

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

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