Sicily 1453. Conformity

来源:互联网 发布:越南经济数据网站 编辑:程序博客网 时间:2024/06/11 00:01

1453. Conformity

Constraints

Time Limit: 2 secs, Memory Limit: 32 MB

Description

Frosh commencing their studies at Waterloo have diverse interests, as evidenced by their desire to take various combinations of courses from among those available.

University administrators are uncomfortable with this situation, and therefore wish to offer a conformity prize to frosh who choose one of the most popular combinations of courses. How many frosh will win the prize?

Input

The input consists of several test cases followed by a line containing 0. Each test case begins with an integer 1 ≤ n ≤ 10000, the number of frosh. For each frosh, a line follows containing the course numbers of five distinct courses selected by the frosh. Each course number is an integer between 100 and 499.

Output

The popularity of a combination is the number of frosh selecting exactly the same combination of courses. A combination of courses is considered most popular if no other combination has higher popularity. For each line of input, you should output a single line giving the total number of students taking some combination of courses that is most popular.

Sample Input

3100 101 102 103 488100 200 300 101 102103 102 101 488 1003200 202 204 206 208123 234 345 456 321100 200 300 400 4440

Sample Output

2

3

// Problem#: 1453// Submission#: 3312955// The source code is licensed under Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License// URI: http://creativecommons.org/licenses/by-nc-sa/3.0/// All Copyright reserved by Informatic Lab of Sun Yat-sen University#include <iostream>#include <vector>#include <algorithm>#include <stdio.h>#include <math.h>#include <string.h>#include <string>#include <queue>#include <set>#include <iomanip>#include <map>using namespace std;int main() {    std::cout.sync_with_stdio(false);    string temp;    while (1) {       int n;       cin >> n;       int MAX = -1;       if (n == 0) break;       map<long long int, int> counter;       for (int i = 0; i < n; i++) {           int a[5];           for (int j = 0; j < 5; j++) cin >> a[j];           sort(a, a + 5);           long long int temp = 0;           for (int j = 0; j < 5; j++) temp = temp * 1000 + a[j];           if (counter.find(temp) == counter.end()) counter[temp] = 1;           else counter[temp]++;           MAX = max(counter[temp], MAX);       }       int ans = 0;       for (map<long long int, int>::iterator iter = counter.begin(); iter != counter.end(); iter++) if (iter->second == MAX) ans += iter->second;       cout << ans << endl;    }    return 0;}                                 


0 0