QOJ.ac

QOJ

Límite de tiempo: 4 s Límite de memoria: 1024 MB Puntuación total: 100

#14869. 同时进行的比赛

Estadísticas

你可以赢得的所有不同比赛的奖品。CC BY-SA 4.0,由 JFS-Chatt 发表在维基共享资源上

由于一些日程安排上的冲突,有 $m$ 场不同的编程比赛被安排在同一天的同一时间进行。有 $n$ 个人想要参加这些比赛,但由于所有比赛同时进行,每个参赛者只能参加其中一场比赛。每个人都希望选择参加某场比赛,以最大化自己的期望奖金。

每场比赛只有唯一的现金奖项授予获胜者(其他人无法获得奖金)。此外,每个参赛者都有一个能力值,这决定了他们的获胜概率。如果某场比赛中所有参赛者的能力值之和为 $t$,那么能力值为 $s$ 的参赛者在这场比赛中的获胜概率为 $\frac{s}{t}$。

请找到一种参赛者在比赛之间的分配方案,使得任何人都无法通过转到另一场比赛来增加其期望奖金。保证存在这样一种分配方案。

输入格式

输入包含以下内容:

  • 第一行包含两个整数 $n$ 和 $m$($1 \le n \le 2 \cdot 10^5$,$1 \le m \le 100$),分别表示参赛者人数和比赛场数。
  • 第二行包含 $n$ 个整数 $s$($1 \le s \le 10^9$),表示参赛者的能力值。
  • 第三行包含 $m$ 个整数 $p$($1 \le p \le 10^9$),表示每场比赛获胜者的奖金。

所有参赛者的能力值之和最多为 $10^9$。

输出格式

对于每场比赛,输出该比赛的参赛人数,后跟参加该比赛的参赛者的 1-based 索引(即从 1 开始的下标)。

如果存在多种合法方案,你可以输出其中任意一种。

样例

样例输入 1

6 3
2 5 10 3 7 1
100 50 75

样例输出 1

4 4 2 6 1
1 5
1 3

样例输入 2

3 2
9 10 8
10 100

样例输出 2

0
3 2 3 1

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.