销售系统问题
---
**Question**
A distributor distributes energy drinks in 34 oz cans to customers who each have a unique ID. It distributes the drinks according to the demand for them. It developed a system that handles all the transaction queries of the store. The system will handle two types of queries (i.e., query 1 and query 2). The first query determines if the customer's ID has already been logged, and, if so, it adds the quantity of the new sale to the previous quantity and updates the record. If the customer's ID has not been logged in before, then it will make a fresh entry. Query 2 retrieves the number of cans purchased by customers in the given range of customer ID. At the end of the day, the distributor must submit a report for all the type 2 queries.
Write an algorithm to help the distributor find the answer for all the type 2 queries.
**Input**
- The first line of the input consists of an integer `numOfCustomer`, representing the number of customers (C).
- The second line consists of two space-separated integers - `numOfQueries` and `queryDesc` representing the number of queries (Q) and the description of queries (queryDesc = 3 always), respectively.
- The next Q lines consist of three space-separated integers, wherein the first integer represents the type of the query and can only be 1 or 2. If the first integer is 1, then it is a type 1 query and the second and third integers represent the customer ID and the quantity of drinks purchased, respectively. If the first integer is 2, then it is a type 2 query, and the second and third integers represent the starting and ending customer ID range (both inclusive).
**Output**
Print space-separated integers representing the answer to all the type 2 queries. If no type 2 query is present, then do not print anything in the output.
**Constraints**
- \( 0 \leq numOfCustomer \leq 10^5 \)
- \( 0 \leq numOfQueries \leq 10^5 \)
- queryDesc = 3
**Example**
Input:
4
5 3
1 3 12
2 0 2
1 1 4
1 3 2
2 1 4问题
输入
输出
约束条件
示例
Last updated