#include #include #include #include using namespace std; int d,p,dimv; char s1[150],s2[150]; struct echipa { char nume[150]; int date,primite,puncte; }; struct echipa v[5]; int este(char *s) { for(int i=1; i<=4; i++) if(strcmp(s,v[i].nume)==0)return i; return 0; } void seteaza(char *s,int d,int p) { if(este(s)==0){ dimv++; strcpy(v[dimv].nume,s); v[dimv].date=d; v[dimv].primite=p; if(d>p)v[dimv].puncte=v[dimv].puncte+3; if(d==p)v[dimv].puncte=v[dimv].puncte+1; } else{ int poz=este(s); v[poz].date= v[poz].date+d; v[poz].primite=v[poz].primite+p; if(d>p)v[poz].puncte=v[poz].puncte+3; if(d==p)v[poz].puncte=v[poz].puncte+1; } } int comp(const void *a,const void *b) { struct echipa *aa=(struct echipa*)a; struct echipa *bb=(struct echipa*)b; if((*aa).puncte < (*bb).puncte)return -1; if((*aa).puncte > (*bb).puncte)return 1; else{ if((*aa).date < (*bb).date)return -1; if( (*aa).date> (*bb).date )return 1; else{ return strcmp((*bb).nume,(*aa).nume); } } } int main() { //freopen("date.in","r",stdin); //freopen("date.out","w",stdout); for(int i=1; i<=6; i++) {cin>>s1>>s2>>d>>p; seteaza(s1,d,p); seteaza(s2,p,d); } //qsort(v+sizeof(struct echipa),4,sizeof(struct echipa),comp); //cout<