#P7131. 「RdOI R1」变换(turn)
「RdOI R1」变换(turn)
Description
There are transformations. The -th transformation has two attributes and . When this transformation is applied to , becomes . The definition of is:
$$f_i(x)=\left\lfloor\dfrac{x}{p_i}\right\rfloor+q_i$$You are given operations. There are two types of operations:
A modify operation can change the attribute values of a transformation.
A query operation gives and two indices and . You need to compute and output:
Input Format
The first line contains two positive integers and .
The second line contains integers, representing .
The third line contains integers, representing .
The next lines each describe one operation:
A modify operation starts with the letter m, followed by three parameters , meaning to modify the -th transformation’s attributes to . It is guaranteed that at any time the attributes satisfy .
A query operation starts with the letter q, followed by three parameters . The meaning is as described above. It is guaranteed that .
Output Format
For each query operation, output one integer, the required answer, separated by newlines.
3 3
2 1 2
1 1 1
q 100 1 3
m 2 2 0
q 100 1 3
27
13
见附件中的 turn-big-sample1.in
见附件中的 turn-big-sample1.out
Hint
Constraints
- For of the testdata, .
- For another of the testdata, .
- For of the testdata, .
File Input/Output (for simulation; not needed when submitting code)
- Filename:
turn.cpp - Input filename:
turn.in - Output filename:
turn.out
Translated by ChatGPT 5
京公网安备 11011102002149号