Learning is light, not learning is darkness
Time limit4sMemory limit1024 MB
Given an array with point updates, answer range queries for the number of divisors of the segment's product, modulo 1000000007.
- Level
Medium6 of 10
- Topics
- Array, Number theory, Segment tree, Math
- Solved
- No attempts yet
Problem
Lately Alf has done nothing at all. He has not even broken anything in the past week. Linn decided it was time he stopped idling and started studying.
Linn chose a simple problem to start with. You are given an array of positive integers. Two kinds of operations are performed on the array:
- 0 i x: assign the value to the -th element of the array.
- 1 l r: output the number of divisors of the product of the numbers on the segment from to . This number can be very large, so output the answer modulo .
Alf is secretly in love with Linn, so he cannot refuse her. He does not want to do the work, though. So he asked you to write a program that solves this problem without Linn finding out.
Input
The first line contains the number (), the number of elements in the array.
The second line contains integers (), the elements of the array.
The third line contains the number (), the number of queries.
Each of the next lines contains three integers. If the first integer is 0, the query updates an array element. If the first integer is 1, the query asks for the number of divisors of the product on a segment.
It is guaranteed that in every query and .
Output
For each query of type 1, output on its own line the number of divisors of the product of all numbers on the given segment, modulo .