Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

怎么一直wa。。。???谁帮忙看看!!!

Posted by zjut003 at 2008-11-12 22:20:24 on Problem 2379
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator