A Lazy Problem

View as PDF

Submit solution

Points: 5
Time limit: 1.0s
Memory limit: 64M

Problem type

Given an array \(a\) of length \(N\) filled with \(0\)s at the beginning, and \(Q\) queries, support the following queries:

  • 1 l r Output the sum of the elements in the subarray \([l,r]\ (1 \le l \le r \le N)\).
  • 2 v Add \(v\) to all elements in the array, \((1 \le v \le 10^5)\).

Input Specification

The first line will contain two integers \(N, Q\ (1 \le N, Q \le 10^5)\).

The next \(Q\) lines will each contain a query of the form defined above.

Output Specification

For each type \(1\) query, output the desired answer.

Sample Input

4 3
1 2 3
2 4
1 2 4

Sample Output



There are no comments at the moment.