#P4140. [清华集训 2014] 奇数国
[清华集训 2014] 奇数国
Description
On a beautiful continent there are countries, numbered from to . The economy is prosperous, there are countless accounting offices, and each country has one bank.
When a big company's leader opened accounts in these banks, he deposited coins in each. He is very stingy, so he will from time to time send his lackey GFS to tally deposits in some banks or ask GFS to change the deposit of a certain bank.
In this land, the summation operation on wealth corresponds to our multiplication. That is, the total deposit when the leader opened accounts is . The banknote denominations issued here are the smallest primes (). Anyone’s wealth can only be represented using these basic denominations. Suppose a person’s wealth is (a positive integer), then $fortune = p_1^{k_1} \times p_2^{k_2} \times \ldots p_{60}^{k_{60}}$.
The leader tends to take deposits from a consecutive range of banks to one accounting office to tally. To avoid GFS colluding with an accounting office, he will not choose the same accounting office every time. After following the leader for many years, GFS has figured out the rule: if the leader chooses to tally the wealth of banks numbered in , he will first “sum” (i.e., multiply) the wealth over (denoted as ), and then pick an accounting office whose number is in to tally the deposits, both to verify his own computation and to check whether the accounting office and GFS are colluding. GFS noticed that if an accounting office’s number is in conflict with , the leader will never choose that office.
What does it mean to be not in conflict with ? If there exist integers such that , then we say is not in conflict with , i.e., that accounting office may be chosen by the leader. When the leader makes a lot more money, he will change the deposit in some bank; thus the computed for the same interval at different times may differ. Moreover, the leader will not let the deposit in any single bank exceed .
Now that GFS knows in advance the leader’s plan for tallying and changing deposits, he wants you to tell him, for each tally, how many accounting offices the leader can choose from. Since this number can be very large, GFS only wants the answer modulo .
Input Format
The first line contains an integer denoting the total number of tally and update operations.
Then follow lines, each with integers . If , this record is a tally plan: the leader will tally deposits of banks from to , and you need to compute the answer GFS wants for this record. If , this record is an update: you should change the deposit of bank to , and you do not need to output anything for this record.
Output Format
For each query, output a single integer per line denoting the answer.
6
0 1 3
1 1 5
0 1 3
1 1 7
0 1 3
0 2 3
18
24
36
6
Hint
Sample Explanation
- Initially, each country’s deposit is .
- The for to is . In , there are numbers not in conflict with .
- The deposit of becomes .
- The for to is . In , there are numbers not in conflict with .
- The deposit of becomes .
- The for to is . In , there are numbers not in conflict with .
- The for to is . In , there are numbers not in conflict with .
Constraints
All testdata satisfy: , .
| Subtask ID | Score | Special Property | ||
|---|---|---|---|---|
| Yes | ||||
| No | ||||
Special property means: all .
Translated by ChatGPT 5
京公网安备 11011102002149号