本文共 2441 字,大约阅读时间需要 8 分钟。
#pragma comment(linker, "/STACK:1024000000,1024000000")#include #include #include #include #include #include #include #include #include #include #include #include #include #include using namespace std;typedef long long ll;typedef unsigned long long ull;typedef pair pii;#define pb(a) push(a)#define INF 0x1f1f1f1f#define lson idx<<1,l,mid#define rson idx<<1|1,mid+1,r#define PI 3.1415926535898template T min(const T& a,const T& b,const T& c) { return min(min(a,b),min(a,c));}template T max(const T& a,const T& b,const T& c) { return max(max(a,b),max(a,c));}void debug() {#ifdef ONLINE_JUDGE#else freopen("in.txt","r",stdin); freopen("d:\\out1.txt","w",stdout);#endif}int getch() { int ch; while((ch=getchar())!=EOF) { if(ch!=' '&&ch!='\n')return ch; } return EOF;}const int maxn=505;const double eps=1e-8;int isprime(int n){ if(n==1||n==0)return 0; if(n==2)return 1; for(int i=2;i*i<=n;i++) if(n%i==0)return false; return true;}struct APP{ char name[50]; char belong[50]; char sex; vector solved; vector rating; double score; bool operator < (const APP &ant ) const { if(fabs(score-ant.score)>eps) return score>ant.score; else return strcmp(name,ant.name)<0?1:0; }}da[maxn];map prize;int prob[10005];int n,m;void cal(){ for(int i=1;i<=n;i++) { da[i].score=0; for(int j=0;j =3) rat=max(1200,da[i].rating[2]); else rat=1200; da[i].score+= (rat-1200)/100.0*1.5; if(da[i].sex=='F') da[i].score += 33; } sort(da+1,da+n+1);}int main(){ int t; scanf("%d",&t); for(int ca=1;ca<=t;ca++) { scanf("%d%d",&n,&m); memset(prob,0,sizeof(prob)); for(int i=1;i<=2;i++) { int x; scanf("%d",&x); for(int j=1;j<=x;j++) { int a; scanf("%d",&a); prob[a]=i; } } int teamnum; scanf("%d",&teamnum); prize.clear(); for(int i=1;i<=teamnum;i++) { char s[50]; int x; scanf("%s%d",s,&x); prize[string(s)]=x; } for(int i=1;i<=n;i++) { da[i].solved.clear(); da[i].rating.clear(); scanf("%s%s",da[i].name,da[i].belong); da[i].sex=getch(); int a,b; scanf("%d%d",&a,&b); for(int j=1;j<=a;j++) { int id; scanf("%d",&id); da[i].solved.push_back(id); } for(int j=1;j<=b;j++) { int rat; scanf("%d",&rat); da[i].rating.push_back(rat); } sort(da[i].rating.begin(),da[i].rating.end(),greater ()); } cal(); for(int i=1;i<=m;i++) { printf("%s %.3lf\n",da[i].name,da[i].score); } } return 0;}
转载于:https://www.cnblogs.com/BMan/p/3713642.html