Skip to content

Instantly share code, notes, and snippets.

@dudelson
Created January 7, 2017 01:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dudelson/b113ece0e325d6348240d37a841a4c33 to your computer and use it in GitHub Desktop.
Save dudelson/b113ece0e325d6348240d37a841a4c33 to your computer and use it in GitHub Desktop.
My solution for UVA 11286
#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