QOJ.ac

QOJ

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

#12319. 九位评委

Statistics

XCPC 决赛的题目选定时间到了!共有 $k$ 道候选题目,最终需要从中选出恰好 $p$ 道题目组成题集。

共有 $n$ 位评委对这些题目进行了评估。每位评委都建立了自己的偏好列表,包含了所有候选题目,按从最喜欢到最不喜欢的顺序排列。

距离 XCPC 决赛还有很长一段时间……好吧,没人知道比赛是否会如期举行。因此,最终的题集将通过一个无限过程来选定。

初始时,$t = 0$,且 $S_0$ 包含从 $k$ 道候选题目中随机均匀选出的 $p$ 道题目。随后,以下操作序列将无限重复:

  • 随机均匀选择题目 $i$ 和 $j$,使得 $i \in S_t$ 且 $j \notin S_t$。
  • 如果至少有 $\frac{n+1}{2}$ 位评委在他们的偏好列表中将 $j$ 排在 $i$ 之前,则令 $S_{t+1} = S_t \setminus \{i\} \cup \{j\}$。否则,令 $S_{t+1} = S_t$。
  • 将 $t$ 增加 1。

如果存在一个正概率阈值 $\varepsilon$,使得在无穷多个时刻 $t$,$P(S_t = S) > \varepsilon$,则称题集 $S$ 是合理的(plausible)。以下是等价的数学符号表示:

$$S \text{ 是合理的} \iff \exists \varepsilon > 0, \forall T \ge 0, \exists t \ge T: P(S_t = S) > \varepsilon$$

你希望为评委们节省一些时间,请找出任意一个合理的题集。

输入格式

第一行包含三个整数 $n, k$ 和 $p$ ($1 \le n \le 9$;$n$ 为奇数;$1 \le p < k \le 50\,000$),分别表示评委人数、候选题目总数以及需要选出的题目数量。

接下来的 $n$ 行,每行包含 $k$ 个整数 $a_{i,1}, a_{i,2}, \dots, a_{i,k}$ ($1 \le a_{i,j} \le k$;当 $j \neq j'$ 时 $a_{i,j} \neq a_{i,j'}$),表示第 $i$ 位评委的偏好列表:$a_{i,1}$ 是他们最喜欢的题目编号,$a_{i,2}$ 是第二喜欢的题目编号,依此类推。

输出格式

输出 $p$ 个 $1$ 到 $k$ 之间互不相同的整数(顺序不限),表示任意一个合理的题集。

样例

输入 1

3 5 3
3 2 5 1 4
1 4 2 5 3
2 4 5 1 3

输出 1

2 1 4

说明

在样例测试用例中,其他可能的答案还有 1 2 52 4 5

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.