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 |
这个题完全没有技巧性,r通过单纯的模拟就过了,无言 #include<iostream> #include<algorithm> #include<cmath> using namespace std; struct ok { int ci,pi,ti,ri; }; bool cmp(ok a,ok b) { return a.ti<b.ti; } struct ac { int t,pi[21],c; }; bool cmp2(ac a,ac b) { if(a.pi[0]!=b.pi[0]) return a.pi[0]>b.pi[0]; if(a.t!=b.t) return a.t<b.t; return a.c<b.c; } int main() { int i,c,n,j; ac a[1005]; ok b[1005]; scanf("%d%d",&c,&n); for(i=0;i<n;i++) scanf("%d%d%d%d",&b[i].ci,&b[i].pi,&b[i].ti,&b[i].ri); sort(b,b+n,cmp); for(i=1;i<=c;i++) { memset(a[i].pi,0,sizeof(a[i].pi)); a[i].t=0; a[i].c=i; } for(i=0;i<n;i++) { if(a[b[i].ci].pi[b[i].pi]==1) continue; if(b[i].ri) { a[b[i].ci].t+=b[i].ti; a[b[i].ci].pi[b[i].pi]=1; a[b[i].ci].pi[0]++; } else if(!b[i].ri) { a[b[i].ci].t+=1200; a[b[i].ci].pi[b[i].pi]--; } } for(i=1;i<=c;i++) { for(j=1;j<=20;j++) { if(a[i].pi[j]<0) { a[i].t-=(-a[i].pi[j])*1200; a[i].pi[j]=0; } } } sort(a+1,a+c+1,cmp2); for(i=1;i<c;i++) printf("%d ",a[i].c); printf("%d\n",a[c].c); return 0; } Followed by:
Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator