QOJ.ac

QOJ

Límite de tiempo: 1 s Límite de memoria: 64 MB Puntuación total: 100

#10992. 编程竞赛

Estadísticas

Byteman 正在为个人编程竞赛的决赛做准备。在准备过程中,他仔细阅读了条款与条件以及组织规则,发现决赛中将恰好有 $n$ 道题目,每道题目都属于 $k$ 个主题中的一个。同一主题可以有多道题目。Byteman 非常了解决赛的所有参赛者,并且对于每位参赛者,他都知道她在每个领域中的技能值。技能值用正整数表示,数值越大,技能水平越高。

决赛中的每道题目都有一定的难度,用正整数表示。Byteman 假设只有当参赛者的技能值不小于题目难度时,她才能解出该题。对于每道解出的题目,参赛者获得的得分为她的技能值与题目难度之差。最终排名基于解出题目的数量(解出题目更多的参赛者排名总是高于解出题目较少的参赛者)。如果解出题目数量相同,则根据得分进行排序(得分越高,排名越高)。

Byteman 没有刻苦训练,而是开始思考是否存在这样一套题目,使得他能够获胜。他在确定这一点上遇到了困难,最终还是想稍微准备一下,所以他向你寻求帮助。你可以假设如果 Byteman 与他人并列第一,他不算获胜。

输入格式

第一行包含一个整数 $t$ ($1 \le t \le 10$),表示测试用例的数量。接下来是所有测试用例的描述。

每个测试用例的第一行包含三个正整数 $n$、$m$ 和 $k$ ($1 \le n \le 400$, $1 \le k \cdot m \le 400$),分别表示题目数量、参赛者数量和主题数量,以空格分隔。接下来的 $m$ 行描述参赛者。第 $i$ 行包含 $k$ 个区间为 $[1, 1000]$ 的整数,以空格分隔,表示第 $i$ 位参赛者在所有主题中的技能值。这 $m$ 行中的第一行描述的是 Byteman。

输出格式

向标准输出写入 $t$ 行,每个测试用例一行。单个测试用例的答案为 TAK(表示是)或 NIE(表示否),取决于 Byteman 是否有机会赢得决赛。

样例

输入 1

2
3 6 5
70 100 100 70 100
205 180 70 200 150
180 200 30 25 45
75 45 80 180 180
120 10 120 90 10
15 110 135 150 210
2 2 2
12 12
20 20

输出 1

TAK
NIE

说明 1

对于第一个测试用例,一种可能使 Byteman 获胜的题目集是:一道难度为 5 的第一主题题目,一道难度为 20 的第二主题题目,以及一道难度为 75 的第三主题题目。在这种情况下,最终得分如下:

  • Byteman(参赛者 1):3 道题,170 分
  • 参赛者 6:3 道题,160 分
  • 参赛者 4:3 道题,100 分
  • 参赛者 2:2 道题,360 分
  • 参赛者 3:2 道题,355 分
  • 参赛者 5:2 道题,160 分

对于第二个测试用例,不存在满足要求的题目选择。

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.