Created
January 6, 2013 22:55
-
-
Save tsu-nera/4470858 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| /* | |
| * TopCoder | |
| * SRM494 Div2 Level1 | |
| */ | |
| #include <algorithm> | |
| #include <iostream> | |
| #include <map> | |
| #include <numeric> | |
| #include <set> | |
| #include <sstream> | |
| #include <string> | |
| #include <vector> | |
| using namespace std; | |
| #define FOR(i,s,e) for (int i = int(s); i != int(e); i++) | |
| #define FORIT(i,c) for (typeof((c).begin()) i = (c).begin(); i != (c).end(); i++) | |
| #define ISEQ(c) (c).begin(), (c).end() | |
| class InterestingParty { | |
| public: | |
| int bestInvitation(vector<string> first, vector<string> second) { | |
| map<string, int> dic; | |
| for (int i = 0; i < first.size(); i++) { | |
| dic[first[i]] = 0; | |
| dic[second[i]] = 0; | |
| } | |
| for (int j = 0; j < first.size(); j++) { | |
| dic[first[j]]++; | |
| dic[second[j]]++; | |
| } | |
| int ans = 0; | |
| map<string, int>::iterator it; | |
| for( it=dic.begin(); it!=dic.end(); it++ ) { | |
| if( ans < it->second ) { | |
| ans = it->second; | |
| } | |
| } | |
| return ans; | |
| } | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment