QOJ.ac

QOJ

حد الوقت: 1 s حد الذاكرة: 1024 MB مجموع النقاط: 100

#3701. 项链

الإحصائيات

frog 有 $n$ 颗宝石排成一个环,其“美观度”分别为 $a_1, a_2, \dots, a_n$。 她想要移除一些宝石,在保持剩余宝石相对顺序不变的前提下,将它们组成一条“美丽的项链”。

注意,一条“美丽的项链”可以被分为 $3$ 个连续的部分 $X, y, Z$,其中:

  1. $X$ 由美观度非递减的宝石组成。
  2. $y$ 是唯一的“完美宝石”。(“完美宝石”是指美观度等于 $10000$ 的宝石)。
  3. $Z$ 由美观度非递增的宝石组成。

求剩余宝石的美观度之和的最大值。

输入格式

输入包含多组测试数据。对于每组测试:

第一行包含 $1$ 个整数 $n$ ($1 \leq n \leq 10^5$)。 第二行包含 $n$ 个整数 $a_1, a_2, \dots, a_n$ ($0 \leq a_i \leq 10^4$,$1 \leq \text{完美宝石的数量} \leq 10$)。

输出格式

对于每组测试,输出 $1$ 个整数,表示剩余宝石美观度之和的最大值。

样例

样例输入 1

6
10000 3 2 4 2 3
2
10000 10000

样例输出 1

10010
10000

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.