QOJ.ac

QOJ

时间限制: 2 s 内存限制: 2048 MB 总分: 100

#9814. 荷兰民主

统计

荷兰政府的组建过程已经连续三次选举耗时超过半年。也许我们可以简化组建联盟的初始阶段?

选举结果公布后的第一步是找到一组政党(称为联盟),使其拥有的席位足以形成绝对多数。你的任务是计算满足特定条件的候选联盟数量。如果一个联盟满足以下两个条件,则被视为候选联盟:

  • 绝对多数:联盟持有的总席位必须严格大于所有政党总席位的一半。
  • 无多余政党:该联盟必须是极小的,即移除联盟中的任何一个政党都会导致其失去绝对多数地位。

图 D.1:样例输入 2 的示意图。

输入格式

输入包含: 一行包含一个整数 $n$ ($1 \le n \le 60$),表示政党数量。 一行包含 $n$ 个整数 $p$ ($1 \le p \le 10\,000$),表示每个政党拥有的席位数。

输出格式

输出满足上述条件的候选联盟总数。

样例

样例输入 1

5
3 1 4 1 5

样例输出 1

4

样例输入 2

11
191 24 148 38 8 28 9 1 3 3 12

样例输出 2

38

样例输入 3

4
1 2 3 4

样例输出 3

3

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.