Very Simple Problem
| Time Limit:1s | Memory limit:32M |
| Accepted Submit:111 | Total Submit:317 |
|
During a preparation of programming contest, its jury is usually faced with many difficult tasks. One of them is to select a problem simple enough to most, if not all, contestants to solve. The difficulty here lies in diverse meanings of the term "simple" amongst the jury members. So, the jury uses the following procedure to reach a consensus: each member weights each proposed problem with a positive integer "complexity rating" (not necessarily different for different problems). The jury member calls "simplest" those problems that he gave the minimum complexity rating, and "hardest" those problems that he gave the maximum complexity rating. The ratings received from all jury members are then compared, and a problem is declared as "very simple", if it was called as "simplest" by more than a half of the jury, and was called as "hardest" by nobody. Input The first line of input file contains integers N and P, the number of jury members and the number of problems. The following N lines contain P integers in range from 0 to 1000 each - the complexity ranks. 1 <= N, P <= 100 Output Output must contain an ordered list of problems called as "very simple", separated by spaces. If there are no such problems, output must contain a single integer 0 (zero). Sample Input 4 4 1 1 1 2 5 900 21 40 10 10 9 10 3 4 3 5 Sample Output 3 Original: Northeastern Europe 2002, Far-Eastern Subregion |
解题:
找出每行最大最小的问题,分别存在min数组和max数组。再在min数组中找出超过n/2次的数,而且这个数没有在max数组中的,即是要求的数。输出要按顺序。
本文介绍了一个竞赛题目,任务是通过程序来确定哪些问题是大多数参赛者能够解决的“非常简单”的问题。具体而言,程序需要从评委给出的复杂度评分中筛选出被超过一半评委认为最简单且无人认为最难的问题。
237

被折叠的 条评论
为什么被折叠?



