QOJ.ac

QOJ

Limite de temps : 1 s Limite de mémoire : 256 MB Points totaux : 100

#4733. 简单

Statistiques

给定一个包含 $N$ 个数字的序列和 $Q$ 次查询:

  • 0 a b val:将区间 $[a, b]$ 内的所有数字加上 val
  • 1 a b:输出区间 $[a, b]$ 内的最小偶数和最大奇数;如果其中某个数字不存在,则在该位置输出 -1

任务

回答所有类型为 1 的查询。

输入格式

第一行包含一个整数 $N$。第二行包含 $N$ 个整数,表示序列中的数字。第三行包含一个整数 $Q$,接下来的 $Q$ 行包含 $Q$ 次查询,格式如题目描述所述。

输出格式

输出包含所有类型为 1 的查询的答案,每行一个。

数据范围

  • 序列中的数字在 $1$ 到 $2\,000\,000\,000$ 之间。
  • 类型 0 查询中的 val 在 $1$ 到 $2\,000\,000\,000$ 之间。
  • 警告!!如果类型 1 查询的某个答案无法计算,则在该位置输出 -1!!
子任务 分值 限制
1 30 分 $N, Q \le 5000$
2 30 分 $N, Q \le 200\,000$ 且没有类型 0 查询
3 40 分 $N, Q \le 200\,000$

样例

输入 1

7
5 6 3 1 9 8 5
10
1 2 5
0 2 3 2
1 2 4
0 2 7 3
1 2 4
1 4 7
0 5 7 1
1 1 6
1 1 2
1 3 4

输出 1

6 9
8 5
4 11
4 11
4 13
-1 11
4 -1

说明

初始序列为:$5, 6, 3, 1, 9, 8, 5$。 查询 1 2 5:输出区间 $[2, 5]$ 内指定的两个数字。 查询 0 2 3 2:新序列为 $5, 8, 5, 1, 9, 8, 5$。 查询 1 2 4:输出区间 $[2, 4]$ 内指定的两个数字。 查询 0 2 7 3:新序列为 $5, 11, 8, 4, 12, 11, 8$。 查询 1 2 4:输出区间 $[2, 4]$ 内指定的两个数字。 查询 1 4 7:输出区间 $[4, 7]$ 内指定的两个数字。 查询 0 5 7 1:新序列为 $5, 11, 8, 4, 13, 11, 8$。 查询 1 1 6:输出区间 $[1, 6]$ 内指定的两个数字。 查询 1 1 2:输出区间 $[1, 2]$ 内指定的两个数字。 查询 1 3 4:输出区间 $[3, 4]$ 内指定的两个数字。

Discussions

About Discussions

The discussion section is only for posting: General Discussions (problem-solving strategies, alternative approaches), and Off-topic conversations.

This is NOT for reporting issues! If you want to report bugs or errors, please use the Issues section below.

Open Discussions 0
No discussions in this category.

Issues

About Issues

If you find any issues with the problem (statement, scoring, time/memory limits, test cases, etc.), you may submit an issue here. A problem moderator will review your issue.

Guidelines:

  1. This is not a place to publish discussions, editorials, or requests to debug your code. Issues are only visible to you and problem moderators.
  2. Do not submit duplicated issues.
  3. Issues must be filed in English or Chinese only.
Active Issues 0
No issues in this category.
Closed/Resolved Issues 0
No issues in this category.