#include #include #include #include using namespace std; /// pentru fiecare echipa, echipa = cheie /// ne trebuie o pereche de intregi (nr_goluri, nr_pct) /// (cheie, valoare) map > mymap; //// V = {10, 100, 70, 5} //// int elemente = v[2] (100) /// element ++; /// v[2] = element; /// /// o variabila are un tip: tip are mai multe campuri pair > v[100]; bool cmp(pair > x, pair > y) { /// daca numarul de pucnte a lui x > numarul de puncte a lui y /// return 1 /// else daca numarul de puncte a lui x < numar de pct a lui y /// return 0; /// altfel /// if(numarul de goluri a lui a > numarul de goluri a lui B /// return 1 /// altfel return 0 if(x.second.second > y.second.second) return 1; else if(x.second.second < y.second.second) return 0; else if(x.second.first > y.second.first) return 1; else return 0; } int main() { #ifndef ONLINE_JUDGE freopen("input.in", "r", stdin); freopen("output.out", "w", stdout); #endif for(int i = 1 ; i <= 6 ; ++ i) { string TeamA; string TeamB; int goluriA; int goluriB; cin>>TeamA>>TeamB>>goluriA>>goluriB; int pctA=0; int pctB=0; if(goluriA>goluriB) pctA=3; else if(goluriB>goluriA) pctB=3; else pctA=1,pctB=1; pair lastA = mymap[TeamA]; lastA.first = lastA.first + goluriA; lastA.second = lastA.second + pctA; /// in variabila lastA avem scorul dupa meciul actual (i) mymap[TeamA] = lastA; pair lastB = mymap[TeamB]; lastB.first = lastB.first + goluriB; lastB.second = lastB.second + pctB; mymap[TeamB] = lastB; } int lg = 0; for(map > :: iterator it = mymap.begin() ; it != mymap.end() ; ++ it) v[++ lg] = *it; sort(v + 1, v + 5, cmp); for(int i = 1 ; i <= 4 ; ++ i) cout << v[i].first << '\n'; return 0; }