#include #include #include #include #include #include using namespace std; int pc(int a) { int res = 1; while (a /= 10) ++res; return res; } int bmaxa(int a, int & b) { if (a > b) b = a; return b; } struct team { int pts; int gg, gt; int won, lost, tied; int order; team(int order_) :pts(0),gg(0),gt(0),won(0),lost(0),tied(0), order(order_) {} bool operator<(const team &r) const { if(pts!=r.pts) return pts>r.pts; if(gg-gt!=r.gg-r.gt) return gg-gt>r.gg-r.gt; if(gg!=r.gg) return gg>r.gg; if(won!=r.won) return won>r.won; return order>r.order; } }; int nteams; typedef map Map; typedef pair ii; typedef map Foo; string tnames[100]; int main() { while(cin>>nteams, nteams) { Map m; unsigned maxtlen=0; for(int i=0; i>tnames[i]; if(tnames[i].size()>maxtlen) maxtlen=tnames[i].size(); m.insert(make_pair(tnames[i], team(i))); } int ngames; cin>>ngames; Foo foo; for(int k=0; k>tname>>tmp>>tname2; cin>>tmp; team *t1=&m.find(tname)->second,*t2=&m.find(tname2)->second; int s1=tmp[0]-'0',s2=tmp[2]-'0'; foo[make_pair(t1->order, t2->order)]=make_pair(s1,s2); if(s2>s1) { swap(t1,t2); swap(s1,s2); } t1->gg+=s1; t2->gt+=s1; t1->gt+=s2; t2->gg+=s2; if(s1>s2) { t1->pts+=3; t1->won++; t2->lost++; } else { t1->pts++; t2->pts++; t1->tied++; t2->tied++; } } puts("RESULTS:"); stringstream str; str<<'+'; for(unsigned i=0; isecond.first<<':'<second.second<<'|'; } cout< v; for(Map::iterator i=m.begin(); i!=m.end(); ++i) v.push_back(i->second); sort(v.begin(), v.end()); int max1,max2=maxtlen, max3,max4,max5,max6,max7,max8; max1=max3=max4=max5=max6=max7=max8=0; for(int i=0; i