QOJ.ac

QOJ

Time Limit: 0.5 s Memory Limit: 128 MB Total points: 100

#7466. 初始化

統計

题目描述

Mayuri 有 $n$ 颗星星,每颗星星都有一个明亮度 $A_{i}$ 。Mayuri 时常想知道一个区间 $[l,r]$ 内所有星星的明亮度的总和是多少。但是星星是会眨眼的,所以星星的明亮度是会变化的。有的时候,下标为 $y,y+x,y+2x,y+3x,\ldots,y+kx$ 的星星的明亮度会增加 $z$。保证 $y\leq x$。

Mayuri 不怎么会数学,请回答她的询问。答案要对 $10^{9}+7$ 取模。

输入格式

第一行两个整数 $n$ 和 $m$,分别表示星星的数量和操作的数量。

接下来一行 $n$ 个数字 $A_{i}$,表示初始的明亮度。

接下来 $m$ 行,每行先是一个整数表示操作类型,如果为 $1$ 则是修改操作,接下来 $3$ 个整数 $x,y,z$;如果是 $2$ 则为询问操作,接下来两个整数 $l,r$。

输出格式

对于每个询问操作,输出一行表示答案。

样例 #1

样例输入 #1

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

样例输出 #1

9
12
9
13

提示

Idea:yanQval,Solution:yanQval,Code:yanQval,Data:yanQval&nzhtl1477

对于 $10\%$ 的数据,满足 $n,m\leq 1000$。

对于另外 $10\%$ 的数据,满足 $x>1000$。

对于另外 $10\%$ 的数据,满足 $x>300$。

对于另外 $10\%$ 的数据,满足 $n,m \leq 10^5$。

对于 $100\%$ 的数据,$1\leq n,m\leq 2\times 10^5$,$1\leq y\leq x\leq n$,$1\leq l\leq r\leq n$,$0\leq A_i,z \leq 10^{9}+7$。

About Issues

We understand that our problem archive is not perfect. If you find any issues with the problem, including the statement, scoring configuration, time/memory limits, test cases, etc.

You may use this form to submit an issue regarding the problem. A problem moderator will review your issue and proceed it properly.

STOP! Before you submit an issue, please READ the following guidelines:

  1. This is not a place to publish a discussion, editorial, or requests to debug your code. Your issue will only be visible by you and problem moderators. Other users will not be able to view or reply your issues.
  2. Do not submit duplicated issues. If you have already submitted one, please wait for an moderator to review it. Submitting multiple issues will not speed up the review process and might cause your account to be banned.
  3. Issues must be filed in English or Chinese only.
  4. Be sure your issue is related to this problem. If you need to submit an issue regarding another problem, contest, category, etc., you should submit it to the corresponding page.

Active Issues 0

No issues in this category.

Closed/Resolved Issues 0

No issues in this category.