Universal Cup Judging System

Universal Cup

Límite de tiempo: 1 s Límite de memoria: 256 MB Puntuación total: 100 Dificultad: [mostrar]
Estadísticas

Prof. Pang 邀请了 $n$ 位教授参加他的宴会。教授们围坐在一张圆桌旁。对于所有从 $1$ 到 $n$ 的 $i$,教授 $i$ 与教授 $(i \pmod n) + 1$ 和 $((i + n - 2) \pmod n) + 1$ 相邻。

Prof. Pang 准备了 $n$ 道菜。桌上有 $n$ 个位置,位置 $i$ 位于教授 $i$ 的正前方。教授 $i$ 只能接触到放置在位置 $i$、$(i \pmod n) + 1$ 和 $((i + n - 2) \pmod n) + 1$ 处的菜肴。Prof. Pang 将在每个位置恰好放置一道菜。

在这些菜中,有 $a$ 道是辣的,$n - a$ 道是不辣的。一些(可能为 0)教授不能吃辣。如果一位教授可以吃辣,他/她的满意度是他/她能接触到的菜肴总数(无论是否为辣)。如果一位教授不能吃辣,他/她的满意度是他/她能接触到的不辣菜肴的数量。

Prof. Pang 知道每位教授是否能吃辣。请帮助他安排桌上的菜肴,使得所有教授的满意度之和最大化。输出该最大和。

样例

输入格式 1

5 2
1 0 1 0 1

输出格式 1

13

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.