P8524 [Ynoi2078] Reading Report on "A theory of consciousness from a theoretical computer science perspective: Insights from the Conscious Turing Machine" (Updating...)

Background

## 警告:滥用本题将被封号。

Description

Given a sequence $a_1,\dots,a_n$ of length $n$, you need to perform $m$ operations. There are three types of operations: Operation 1: Given $l,r,x$, first create a new array $b$ such that $b_i=a_i$. Then simultaneously modify $a_x,\dots,a_{x+r-l}$ to $b_l,\dots,b_r$. Operation 2: Given $l,r$, simultaneously modify $a_l,\dots,a_r$ to the value obtained by dividing by $2$ and taking the floor. Operation 3: Given $l,r$, compute the sum of $a_l,\dots,a_r$.

Input Format

The first line contains an integer $n$. The next line contains $n$ integers representing the sequence $a_1,\dots,a_n$. The next line contains an integer $m$. The next $m$ lines each describe one operation: `1 l r x` means Operation 1. `2 l r` means Operation 2. `3 l r` means Operation 3.

Output Format

For each Operation 3, output one line containing one integer, which is the answer.

Explanation/Hint

Warning: Misusing this problem will result in your account being banned. For $100\%$ of the data, $1\le n\le 3\cdot 10^6$ and $1\le m\le 3\cdot 10^6$. The initial values of the sequence satisfy $1\le a_i\le 10^9$. For each operation, $1\le l\le r\le n$. For each Operation 1, $1\le x\le x+r-l+1\le n$. All values above are integers. Translated by ChatGPT 5