SRM494 Div2 Easy(250) InterestingParty
#include <string> #include <vector> using namespace std; class InterestingParty{public: int bestInvitation( vector <string> first, vector <string> second ) { int n = (int)first.size(); int ans = 0; for ( int i=0; i<n; i++ ) { int c = 0; for ( int j=0; j<n; j++ ) if ( first[j] == first[i] || second[j] == first[i] ) c++; ans = max( ans, c ); c = 0; for ( int j=0; j<n; j++ ) if ( first[j] == second[i] || second[j] == second[i] ) c++; ans = max( ans, c ); } return ans; }};