Created
January 7, 2017 01:53
-
-
Save dudelson/b113ece0e325d6348240d37a841a4c33 to your computer and use it in GitHub Desktop.
My solution for UVA 11286
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <map> | |
#include <algorithm> | |
using namespace std; | |
#define maxn (int)(1e5)+1 | |
int n; | |
map<vector<int>, int> m; | |
int main() { | |
while(cin >> n, n) { | |
m.clear(); | |
for(int i=0; i<n; i++) { | |
vector<int> c(5); | |
for(auto &x: c) cin >> x; | |
sort(c.begin(), c.end()); | |
m[c]++; | |
} | |
int max_val = 0; | |
for(map<vector<int>, int>::iterator it=m.begin(); it!=m.end(); ++it) { | |
max_val = max(max_val, it->second); | |
} | |
int cnt = 0; | |
for(map<vector<int>, int>::iterator it=m.begin(); it!=m.end(); ++it) { | |
if(it->second == max_val) cnt++; | |
} | |
cout << max_val*cnt << '\n'; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment