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

19472번 - Array and Operations 다국어

시간 제한메모리 제한제출정답맞힌 사람정답 비율
1 초 512 MB34118015655.516%

문제

You have an array $a$ with $n$ integers. There are three types of operations:

  • "1 $l$ $r$ $x$": for each $i$ in $[l, r],ドル change $a_i$ to $a_i + x$;
  • "2 $l$ $r$": for each $i$ in $[l, r],ドル change $a_i$ to $\lfloor \sqrt{a_i} \rfloor$;
  • "3 $l$ $r$": sum up $a_i$ for all $i$ in $[l, r]$ and print the answer.

Your goal is to process the operations and print the answers of all type 3 operations.

입력

The first line of the input contains two integers $n$ and $q$ (1ドル \le n, q \le 10^5$). The second line contains $n$ integers $a_1, \ldots, a_n$. Then $q$ lines follow, each line describes an operation.

It is guaranteed that 1ドル \le a_i, x \le 10^5,ドル 1ドル \le l \le r \le n$.

출력

For each operation of type 3, print a single line containing the required sum.

제한

예제 입력 1

5 5
1 2 3 4 5
1 3 5 2
2 1 4
3 2 4
2 3 5
3 1 5

예제 출력 1

5
6

힌트

출처

Camp > Petrozavodsk Programming Camp > Summer 2016 > Day 4: Ce Bin and Ryyi Ji Contest 1 H번

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

출처

대학교 대회

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

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