CF1638E.Colorful Operations
普及/提高-
通过率:0%
AC君温馨提醒
该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。
题目描述
You have an array a1,a2,…,an . Each element initially has value 0 and color 1 . You are also given q queries to perform:
- Color l r c : Change the color of elements al,al+1,⋯,ar to c ( 1≤l≤r≤n , 1≤c≤n ).
- Add c x : Add x to values of all elements ai ( 1≤i≤n ) of color c ( 1≤c≤n , −109≤x≤109 ).
- Query i : Print ai ( 1≤i≤n ).
输入格式
The first line of input contains two integers n and q ( 1≤n,q≤106 ) — the length of array a and the number of queries you have to perform.
Each of the next q lines contains the query given in the form described in the problem statement.
输出格式
Print the answers to the queries of the third type on separate lines.
输入输出样例
输入#1
5 8 Color 2 4 2 Add 2 2 Query 3 Color 4 5 3 Color 2 2 3 Add 3 3 Query 2 Query 5
输出#1
2 5 3
输入#2
2 7 Add 1 7 Query 1 Add 2 4 Query 2 Color 1 1 1 Add 1 1 Query 2
输出#2
7 7 8
说明/提示
The first sample test is explained below. Blue, red and green represent colors 1 , 2 and 3 respectively.