#include #include #include #include #include #define totalPoints first #define totalGoals second #define name first #define stats second using namespace std; map > M; vector >> v; int goalsA, goalsB, bonusA, bonusB; string teamA, teamB; bool cmp(pair > A, pair > B) { if(A.stats.totalPoints != B.stats.totalPoints) return A.stats.totalPoints > B.stats.totalPoints; if(A.stats.totalGoals != B.stats.totalGoals) return A.stats.totalGoals > B.stats.totalGoals; return A.name < B.name; } int main() { for(int i=1; i<=6; i++) { cin>>teamA>>teamB>>goalsA>>goalsB; if(goalsA > goalsB) bonusA = 3, bonusB = 0; else if(goalsA == goalsB) bonusA = 1, bonusB = 1; else bonusA = 0, bonusB = 3; if(M.find(teamA) == M.end()) M[teamA] = make_pair(0, 0); if(M.find(teamB) == M.end()) M[teamB] = make_pair(0, 0); M[teamA] = make_pair(M[teamA].totalPoints + bonusA, M[teamA].totalGoals + goalsA); M[teamB] = make_pair(M[teamB].totalPoints + bonusB, M[teamB].totalGoals + goalsB); } for(auto team:M) v.push_back(team); sort(v.begin(), v.end(), cmp); for(auto team:v) cout<