#abc368g. G - Add and Multiply Queries
G - Add and Multiply Queries
Score : points
问题陈述
你得到了两个正整数序列 和 ,它们的长度都是 。按照给定的顺序处理 个查询,每个查询的形式如下。每个查询是以下三种类型之一。
- 类型 :以
1 i x
的形式给出。将 替换为 。 - 类型 :以
2 i x
的形式给出。将 替换为 。 - 类型 :以
3 l r
的形式给出。解决以下问题并打印答案。- 最初,设置 。按照这个顺序,对于 ,将 替换为 或 。找到最终可能的最大 值。
保证给定类型 查询的答案最多为 。
以上为大语言模型 kimi 翻译,仅供参考。
Problem Statement
You are given sequences of positive integers and of length . Process queries given in the following forms in the order they are given. Each query is of one of the following three types.
- Type : Given in the form
1 i x
. Replace with . - Type : Given in the form
2 i x
. Replace with . - Type : Given in the form
3 l r
. Solve the following problem and print the answer.- Initially, set . For in this order, replace with either or . Find the maximum possible value of at the end.
It is guaranteed that the answers to the given type queries are at most .
Constraints
- For type and queries, .
- For type and queries, .
- For type queries, .
- For type queries, the value to be printed is at most .
Input
The input is given from Standard Input in the following format:
Here, is the -th query, given in one of the following formats:
Output
Let be the number of type queries. Print lines. The -th line should contain the answer to the -th type query.
Sample Input 1
3
3 2 4
1 2 2
3
3 1 3
1 1 1
3 1 3
Sample Output 1
12
7
For the first query, the answer is . For the third query, the answer is .
Sample Input 2
6
65 32 12 5 8 312
4 1 3 15 16 2
6
3 2 6
3 1 5
1 5 6
2 4 9
3 2 6
3 3 5
Sample Output 2
46080
69840
27648
1728