POJ 2535 Very Simple Problem(我的水题之路——看错题)

来源:互联网 发布:淘宝申诉进程在哪看 编辑:程序博客网 时间:2024/04/30 15:13
Very Simple Problem
Time Limit: 2000MS Memory Limit: 65536KTotal Submissions: 3284 Accepted: 1232

Description

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 file 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 41 1 1 25 900 21 4010 10 9 103 4 3 5

Sample Output

3

Source

Northeastern Europe 2002, Far-Eastern Subregion

N个评委,P道题目,每个评委对每道题进行评分。对于单个评委来说,如果他评分中的最高分的题目被视为该评委认定的“最困难的题目”,他评分中的最低分的题目被视为该评委认定的“最简单的题目”。对于每一道题,如果没有评委评定为“最困难的题目”,且有超过半数(不等于)的评委评定为“最简单的题目”,则这就可以被认为是“非常简单的题目”。现在请将“非常简单的题目”的题号输出(这个是隐含的信息,按照评委对题目的评定顺序决定,题号从1开始),且用空格间隔。

这道题看题目看了好久好久,因为一开始看错了题目,Description看懂了,不过Input和Output的说明没有看清楚,导致样例一直看不懂,重复看了很多遍Description,但是没有仔细研究Input和Output的内容,纠结了我两个小时(T_T)。

注意点:
1)仔细看题,不仅仅是Description、Input、Output都要仔细看懂。

代码(1AC):
#include <cstdio>#include <cstdlib>#include <cstring>int N, P;int arr[110];int easy[110];int hard[110];int main(void){    int i, j;    int tmp, flag;    int min, max;    while (scanf("%d%d", &N, &P) != EOF){        memset(easy, 0, sizeof(easy));        memset(hard, 0, sizeof(hard));        for (i = 0; i < N; i++){            min = 10000;            max = -1;            for (j = 0; j < P; j++){                scanf("%d", &arr[j]);                if (min > arr[j]){                    min = arr[j];                }                if (max < arr[j]){                    max = arr[j];                }            }            for (j = 0; j < P; j++){                if (arr[j] == min){                    easy[j]++;                }                if (arr[j] == max && !hard[j]){                    hard[j] = 1;                }            }        }       /* for (i = 0; i < P; i++){            printf("%d ", hard[i]);        }        printf("\n");        for (i = 0; i < P; i++){            printf("%d ", easy[i]);        }        printf("\n");*/        flag = 0;        for (i = 0; i < P; i++){            if (easy[i] > N / 2 && hard[i] == 0){                if (flag){                    printf(" ");                }                printf("%d", i + 1);                flag = 1;            }        }        if (flag == 0){            printf("0\n");        }        else{            printf("\n");        }    }    return 0;}


原创粉丝点击