[线段树+欧拉函数+状态压缩] 区间修改 求区间积的欧拉函数 CF1114F

这是一个关于数组操作的问题,需要处理区间乘法和求区间内数的欧拉函数值模10^9+7。题目给出一个包含n个元素的数组,进行q次操作,包括区间乘法和求区间欧拉函数值。在处理过程中,需要理解并应用Euler's totient function的概念。
摘要由CSDN通过智能技术生成

F. Please, another Queries on Array?

time limit per test

5.5 seconds

memory limit per test

256 megabytes

input

standard input

output

standard output

You are given an array a1,a2,…,ana1,a2,…,an.

You need to perform qq queries of the following two types:

  1. "MULTIPLY l r x" — for every ii (l≤i≤rl≤i≤r) multiply aiai by xx.
  2. "TOTIENT l r" — print φ(∏i=lrai)φ(∏i=lrai) taken modulo 109+7109+7, where φφ denotes Euler's totient function.

The Euler's totient function of a positive integer nn (denoted as φ(n)φ(n)) is the number of integers xx (1≤x≤n1≤x≤n) such that gcd(n,x)=1gcd(n,x)=1.

Input

The first line contains two integers nn and qq (1≤n≤4⋅1051≤n≤4⋅105, 1≤q≤2⋅1051≤q≤2⋅105) — the number of elements in array aa and the number of queries.

The second line contains nn integers a1,a2,…,ana1,a2,…,an (1≤ai≤3001≤ai≤300) — the elements of array aa.

Then qq lines follow, describing queries in the format given in the statement.

  1. "MULTIPLY l r x" (1≤l≤r≤n1≤l≤r≤n, 1≤x≤3001≤x≤300) — denotes a multiplication query.
  2. "TOTIENT l r" (1≤l≤r≤n1≤l≤r≤n) — denotes a query on the value of Euler's totient functio
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值