QOJ.ac

QOJ

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

#2195. 选举

الإحصائيات

Byteburg 参议院选举即将到来。通常,“联合拜特兰”(United Byteland)这一执政党会包揽参议院的所有席位,以确保稳定和可持续发展。但今年,其中一个选区出现了一名反对派候选人。即使是一名反对派成员也可能扰乱参议院的稳定,因此党魁要求你确保该反对派候选人不会当选。

共有 $n$ 名候选人,编号从 $1$ 到 $n$。候选人 $n$ 是反对派候选人。选区内共有 $m$ 个投票站,编号从 $1$ 到 $m$。你知道每个投票站在每个候选人身上获得的票数。你唯一能做的就是取消某些投票站的选举结果,以阻止反对派候选人当选。如果反对派候选人在所有未取消的投票站中获得的票数总和严格大于其他任何候选人的票数总和,则反对派候选人当选。

你的任务是通过取消最少数量投票站的选举结果,来阻止反对派候选人当选。请注意,解总是存在的,因为如果你取消所有投票站的选举,每位候选人的票数都将为 $0$,反对派候选人将不会当选。

输入格式

第一行包含两个整数 $n$ 和 $m$ ($2 \le n \le 100; 1 \le m \le 100$),分别表示候选人数和投票站数。接下来的 $m$ 行包含每个投票站的选举结果,每行有 $n$ 个数字。第 $i$ 行的第 $j$ 个数字为 $a_{i,j}$,表示候选人 $j$ 在投票站 $i$ 获得的票数 ($0 \le a_{i,j} \le 1\,000$)。

输出格式

第一行输出一个整数 $k$,表示你需要取消选举结果的投票站的最少数量。第二行输出 $k$ 个整数,表示被取消的投票站的编号,顺序不限。如果存在多种取消 $k$ 个投票站的方法,输出其中任意一种即可。

样例

样例输入 1

5 3
6 3 4 2 8
3 7 5 6 7
5 2 4 7 9

样例输出 1

2
3 1

样例输入 2

2 1
1 1

样例输出 2

0

样例输入 3

3 3
2 3 8
4 2 9
3 1 7

样例输出 3

3
1 2 3

说明

在第一个样例中,候选人 $1$ 到 $5$ 分别获得了 $14, 12, 13, 15$ 和 $24$ 票。反对派候选人票数最多。然而,如果你取消第一个和第三个投票站的选举结果,那么只剩下第二个投票站的结果,各候选人的总票数变为 $3, 7, 5, 6$ 和 $7$,此时反对派候选人不再处于领先地位。

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.