QOJ.ac

QOJ

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

#14639. 星野爱

Statistics

星野爱给了你一张无向图 $G$,设 $R(i)$ 为所有与 $i$ 相连的边的另一个端点构成的可重集合,可能有重边,没有自环。

每个节点有权值 $w_i$,初始时都为 $0$,需要维护两种操作。

  • 1,l,r,v,对于 $i\in [l,r]$,$j\in R(i)$,令 $w_j=w_j+v$
  • 2,l,r,计算 $\sum_{i\in[l,r]}\sum_{j\in R(i)}w_j$。

输出的值请对 $2^{64}$ 取模。

输入格式

第一行三个整数 $n,m,q$。

接下来 $m$ 行,每行两个整数 $u,v$ 代表一条边。

接下来 $q$ 行,每行三个或四个整数代表一个操作。

输出格式

对于操作二,每行输出一个整数表示计算的结果。

样例数据

样例 1 输入

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

样例 1 输出

53
24

子任务

Idea:Larunatrecy,Solution:Larunatrecy,Code:Larunatrecy,Data:Larunatrecy

对于 $20\%$ 的数据,$1\leq n,m,q\leq 5000$。

对于 $40\%$ 的数据,$1\leq n,m,q\leq 5\times 10^4$。

对于另外 $10\%$ 的数据,$l=r$ 恒成立。

对于 $100\%$ 的数据,$1\leq n,m,q\leq 2\times 10^5,0\leq v\leq 10^9$。

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.