#include #include #include #include #include using namespace std; struct Echipa { char id[150]; long p,goals; void init(){ memset(id,0,sizeof(id)); p=goals=0; } }; long i,cnt,g1,g2,id1,id2; Echipa E[5]; char e1[150],e2[150]; long getId1(){ long l1,l2; for(long i=1;i<=cnt;i++){ bool found = 1; l1 = strlen(E[i].id+1); l2 = strlen(e1+1); if(l1!=l2) continue; for(long j=1;j<=l1;j++) if(E[i].id[j]!=e1[j]) {found=false;break;} if(found) return i; } cnt++; for(long i=0;i<150;i++) E[cnt].id[i] = e1[i]; return cnt; } long getId2(){ long l1,l2; for(long i=1;i<=cnt;i++){ bool found=1; l1 = strlen(E[i].id+1); l2 = strlen(e2+1); if(l1!=l2) continue; for(long j=1;j<=l1;j++) if(E[i].id[j]!=e2[j]) {found=false;break;} if(found)return i; } cnt++; for(long i=0;i<150;i++) E[cnt].id[i] = e2[i]; return cnt; } bool cmp(const Echipa& a,const Echipa& b){ if(a.p == b.p) { if(a.goals!=b.goals) return a.goals < b.goals; return a.id[1]