QOJ.ac

QOJ

Time Limit: 2 s Memory Limit: 512 MB Total points: 100

#18770. 数列とクエリ 12

Statistics

入力

最初の行には、数列のサイズ $N$ が与えられる。

2 行目には $A_1, A_2, \ldots, A_N$ が与えられる。

3 行目にはクエリの個数 $M$ が与えられる。

次の $M$ 行にはそれぞれクエリが与えられる。

  • $1 \le N, M \le 100{,}000$
  • $1 \le A_i, y \le 10^9+6$
  • $1 \le x \le |A|$
  • $1 \le l \le r \le |A|$
  • $0 \le z \le |A|$

出力

タイプ 1 およびタイプ 5 のクエリに対して、答えを各行に 1 つずつ、順に出力せよ。

入出力例

入力例 1

5
1 2 3 2 1
8
1 1 3
5 1 5
2 2 4
1 2 4
3 3
4 0 5
1 1 2
1 1 5

出力例 1

6
3
24
0
78

入力例 2

10
5 4 3 5 4 1 5 4 3 1
15
2 8 580347
4 6 503576
1 2 5
5 8 11
1 2 6
4 7 565239
3 6
3 11
3 3
2 9 674360
1 1 6
2 2 589693
4 5 236488
1 8 9
5 2 7

出力例 2

60
4
107
788510349
0
6

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.