CF920F.SUM and REPLACE

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

Let D(x)D(x) be the number of positive divisors of a positive integer xx . For example, D(2)=2D(2)=2 ( 22 is divisible by 11 and 22 ), D(6)=4D(6)=4 ( 66 is divisible by 11 , 22 , 33 and 66 ).

You are given an array aa of nn integers. You have to process two types of queries:

  1. REPLACE ll rr — for every replace aia_{i} with D(ai)D(a_{i}) ;
  2. SUM ll rr — calculate .

Print the answer for each SUM query.

输入格式

The first line contains two integers nn and mm ( 1<=n,m<=31051<=n,m<=3·10^{5} ) — the number of elements in the array and the number of queries to process, respectively.

The second line contains nn integers a1a_{1} , a2a_{2} , ..., ana_{n} ( 1<=ai<=1061<=a_{i}<=10^{6} ) — the elements of the array.

Then mm lines follow, each containing 33 integers tit_{i} , lil_{i} , rir_{i} denoting ii -th query. If ti=1t_{i}=1 , then ii -th query is REPLACE lil_{i} rir_{i} , otherwise it's SUM lil_{i} rir_{i} ( 1<=ti<=21<=t_{i}<=2 , 1<=li<=ri<=n1<=l_{i}<=r_{i}<=n ).

There is at least one SUM query.

输出格式

For each SUM query print the answer to it.

输入输出样例

  • 输入#1

    7 6
    6 4 1 10 3 2 4
    2 1 7
    2 4 5
    1 3 5
    2 4 4
    1 5 7
    2 1 7
    

    输出#1

    30
    13
    4
    22
    
首页