RT,不知道什么原因,样例读入进来的 m 值是 0。
#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<map>
#include<cmath>
#include<algorithm>
#define int long long
using namespace std;
const int N=10005,M=150005;
int dday[13]={0,31,59,90,120,151,181,212,243,273,304,334,365};
struct student{
int xb;//男1女0
int tot=0;
int id;
int bjxly;
int sunshine;
}a[N];
struct result_of_sunshine_running{
string result,start_time,finish_time;
double dist;
int step,num,num114514;
int sssh,sssm;
}b[M];
int n,m;
map<int,int>uid;
inline bool cmp(result_of_sunshine_running x,result_of_sunshine_running y){
if(x.num!=y.num) return x.num<y.num;
else return x.num114514<y.num114514;
}
inline void male_running_score(int i,int x){
if(x<=750){
a[i].tot+=20;
}else if(x<=780){
a[i].tot+=18;
}else if(x<=810){
a[i].tot+=16;
}else if(x<=840){
a[i].tot+=14;
}else if(x<=870){
a[i].tot+=12;
}else if(x<=910){
a[i].tot+=10;
}else if(x<=950){
a[i].tot+=8;
}else if(x<=990){
a[i].tot+=6;
}else if(x<=1030){
a[i].tot+=4;
}else if(x<=1080){
a[i].tot+=2;
}
}
inline void female_running_score(int i,int x){
if(x<=400){
a[i].tot+=20;
}else if(x<=417){
a[i].tot+=18;
}else if(x<=434){
a[i].tot+=16;
}else if(x<=451){
a[i].tot+=14;
}else if(x<=470){
a[i].tot+=12;
}else if(x<=485){
a[i].tot+=10;
}else if(x<=500){
a[i].tot+=8;
}else if(x<=515){
a[i].tot+=6;
}else if(x<=530){
a[i].tot+=4;
}else if(x<=540){
a[i].tot+=2;
}
}
inline void read_second(int i){
int x=0,y=0;
scanf("%d'%d\"",&x,&y);
x=x*60+y;
if(a[i].xb) male_running_score(i,x);
else female_running_score(i,x);
}
int cii(char c){//char in int的简称,为了好写
return c-48;
}
int get_time(int ssh,int ssm,int sss,int SSH,int SSM,int SSS){
return SSH*3600+SSM*60+SSS-ssh*3600-ssm*60-sss;
}
int get_days(int ssmo,int ssd,int ssh,int ssm,int sss){
return (dday[ssmo-1]+ssd)*86400-(24-ssh)*3600-(60-ssm)*60-(60-sss);
}
bool is_6_hours(int x,int y){
int ssmo=cii(b[x].result[4])*10+cii(b[x].result[5]),ssd=cii(b[x].result[6])*10+cii(b[x].result[7]);
int ssh=cii(b[x].start_time[0])*10+cii(b[x].start_time[1]),ssm=cii(b[x].start_time[3])*10+cii(b[x].start_time[4]),sss=cii(b[x].start_time[6])*10+cii(b[x].start_time[7]);
int res1=get_days(ssmo,ssd,ssh,ssm,sss);
ssmo=cii(b[y].result[4])*10+cii(b[y].result[5]),ssd=cii(b[y].result[6])*10+cii(b[y].result[7]);
ssh=cii(b[y].finish_time[0])*10+cii(b[y].finish_time[1]),ssm=cii(b[y].finish_time[3])*10+cii(b[y].finish_time[4]),sss=cii(b[y].finish_time[6])*10+cii(b[y].finish_time[7]);
int res2=get_days(ssmo,ssd,ssh,ssm,sss);
if(res1-res2>=21600) return true;
return false;
}
bool check(int i,int x,int lst,bool ffirst){
if((a[i].xb&&b[x].dist<3.00)||(!a[i].xb&&b[x].dist<1.50)) return false;
int ssh=cii(b[x].start_time[0])*10+cii(b[x].start_time[1]),ssm=cii(b[x].start_time[3])*10+cii(b[x].start_time[4]),sss=cii(b[x].start_time[6])*10+cii(b[x].start_time[7]);
int SSH=cii(b[x].finish_time[0])*10+cii(b[x].finish_time[1]),SSM=cii(b[x].finish_time[3])*10+cii(b[x].finish_time[4]),SSS=cii(b[x].finish_time[6])*10+cii(b[x].finish_time[7]);
int T=get_time(ssh,ssm,sss,SSH,SSM,SSS);
double S=(b[x].dist*1000.0);
double V=S/(T*1.0);
if(V<2.00||V>5.00) return false;
ssh=b[x].sssh,ssm=b[x].sssm;
if(ssh*60+ssm>270) return false;
V=S/(b[x].step*1.0);
if(V>1.50) return false;
if(ffirst) return true;
if(!is_6_hours(x,lst)) return false;//重头戏
return true;
}
int mistake(int x,int l,int r){
int res=0,lst=0;
for(int i=l;i<=r;i++){
if(check(x,i,lst,((!lst)?true:false))) res++,lst=i;
}
return res;
}
int relationship(int i){
if(a[i].sunshine>=21) return 10;
else if(a[i].sunshine>=19) return 9;
else if(a[i].sunshine>=17) return 8;
else if(a[i].sunshine>=14) return 7;
else if(a[i].sunshine>=11) return 6;
else if(a[i].sunshine>=7) return 4;
else if(a[i].sunshine>=3) return 2;
else return 0;
}
int resolution(int i){
int cur=a[i].sunshine+a[i].bjxly;
if(cur>=18) return 5;
else if(cur>=15) return 4;
else if(cur>=12) return 3;
else if(cur>=9) return 2;
else if(cur>=6) return 1;
else return 0;
}
void grade(int i){
printf("%lld ",a[i].id);
printf("%lld ",a[i].tot);
if(a[i].tot>=95) puts("A");
else if(a[i].tot>=90) puts("A-");
else if(a[i].tot>=85) puts("B+");
else if(a[i].tot>=80) puts("B");
else if(a[i].tot>=77) puts("B-");
else if(a[i].tot>=73) puts("C+");
else if(a[i].tot>=70) puts("C");
else if(a[i].tot>=67) puts("C-");
else if(a[i].tot>=63) puts("D+");
else if(a[i].tot>=60) puts("D");
else puts("F");
}
signed main(){
ios::sync_with_stdio(false);
scanf("%lld ",&n);
for(int i=1;i<=n;i++){
scanf("%lld ",&a[i].id);
uid[a[i].id]=i;
char ch;
cin>>ch;
if(ch=='M') a[i].xb=1;
else a[i].xb=0;
int x;
scanf("%lld ",&x);
a[i].tot+=x;
read_second(i);
cin>>ch;
if(ch=='P') a[i].tot+=10;
scanf("%lld ",&x);
a[i].tot+=x;
scanf("%lld ",&a[i].bjxly);
}
scanf("%lld ",&m);
for(int i=1;i<=m;i++){
cin>>b[i].result>>b[i].num>>b[i].start_time>>b[i].finish_time;
scanf("%lf",&b[i].dist);
scanf("%d'%d\"",&b[i].sssh,&b[i].sssm);
cin>>b[i].step;
b[i].num114514=i;
}
sort(b+1,b+m+1,cmp);
int pos=2,last=1;
while(last<=m){
for(;pos<=m;pos++){
if(b[pos].num!=b[pos-1].num) break;
}
a[uid[b[last].num]].sunshine=mistake(uid[b[last].num],last,pos-1);
last=pos,pos++;
}
for(int i=1;i<=n;i++){
a[i].tot+=relationship(i);
a[i].tot+=resolution(i);
}
for(int i=1;i<=n;i++){
grade(i);
}
}