Universal Cup Judging System

Universal Cup

Time Limit: 4 s Memory Limit: 512 MB Total points: 100 Hackable ✓
Statistics

给定一个包含 $n$ 个整数的数组 $a$。你可以对该数组进行操作。在单次操作中,你可以将任意实数 $x$ 加到 $a$ 的某个连续区间上。

确定使 $a$ 中所有元素变为 $0$ 所需的最少操作次数。

输入格式

第一行包含一个整数 $n$ ($1 \le n \le 23$)。

第二行包含数组 $a_1, a_2, \dots, a_n$ ($0 \le a_i \le 10^9$)。

输出格式

输出一行,包含一个整数:所需的最少操作次数。

样例

样例输入 1

5
1 2 3 2 1

样例输出 1

3

样例输入 2

6
1 1 4 5 1 4

样例输出 2

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.