Online Judge | Problem Set | Authors | Online Contests | User | ||||||
---|---|---|---|---|---|---|---|---|---|---|
Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest |
Re:怎么一直wa。。。???谁帮忙看看!!!In Reply To:怎么一直wa。。。???谁帮忙看看!!! Posted by:zjut003 at 2008-11-12 22:20:24 > #include<iostream> > #include<vector> > #include<algorithm> > #include<fstream> > using namespace std; > > struct Team > { > int ACnum, time, exTime,teamNum; > Team(int a, int b, int c, int d) > :ACnum(a),time(b),exTime(c),teamNum(d){} > }; > > bool comp(Team a, Team b) > { > int time1=a.time+a.exTime, > time2=b.time+b.exTime; > if(a.ACnum!=b.ACnum) > return a.ACnum>b.ACnum; > if(time1!=time2) > return time1<time2; > return a.teamNum<b.teamNum; > } > int main() > { > //ifstream cin("aaa.txt"); > > int n,m; cin>>n>>m; > vector<Team> v; > for(int i=0; i<n; i++) > v.push_back(Team(0,0,0,i+1)); > for(int a,b,c,d; m--&&cin>>a>>b>>c>>d; ) > { > if(c>v[a-1].time) v[a-1].time=c; > if(d==1) v[a-1].ACnum++; > else v[a-1].exTime+=1200; > } > sort(v.begin(),v.end(),comp); > for(int i=0,p=0; i<n; i++,p++) > cout<<(p++?" ":"")<<v[i].teamNum; > cout<<endl; > } Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator