QOJ.ac

QOJ

時間限制: 6 s 記憶體限制: 512 MB 總分: 100

#7339. 一个非常奇特的序列

统计

按照我们长期以来的传统,最好的题目描述总是简短的。

给定一个整数序列,求其长度为奇数的连续子序列的最大和。

输入格式

输入的第一行包含测试用例的数量 $z$。接下来是各测试用例的描述。 每个测试用例的第一行包含序列的长度 $n$ ($1 \le n \le 1\,000\,000$)。 下一行包含 $n$ 个整数 $a_1, a_2, \dots, a_n$ ($-10^9 \le a_i \le 10^9$),即序列的元素。 所有测试用例中序列的总长度不超过 $5\,000\,000$。

输出格式

对于每个测试用例,在单独的一行中输出最大和。

样例

样例输入 1

1
4
8 -7 9 1

样例输出 1

10

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.