求助
查看原帖
求助
556362
Unnamed114514楼主2022/2/11 16:17

每个数据都在几百行时差了一点点。

#include<bits/stdc++.h>
#define int long long
using namespace std;
const int ee[]={0,31,28,31,30,31,30,31,31,30,31,30,31};
int aaaa[10005];
struct node{
    char qwq;//性别
    int s;//体育课专项成绩
    int a,b;//期末长跑测试成绩
    char qaq;//体质测试
    int f;//期末检测成绩
    int c;//出勤次数
    int e;//长跑次数
};//学员信息
struct nod{
    int st;
    string st2;//完成日期
    int p;//来源学号
    int h,m,s;//开始时间
    int hh,mm,ss;//结束时间
    double l;
    int l2;//运动距离int
    int a,b;//总暂停时间
    int sum;//运动总步数
};//打卡信息
struct no{
    int a,b,c;//时间点
    string s;//日期
};//时间
inline int sub(no a,no b){
    int x=a.a*60*60+a.b*60+a.c-b.a*60*60-b.b*60-b.c;
    if(x<0)
        x+=24*60*60;
    return x;
}//无视日期的减法
unordered_map<int,node> mp;//数据
unordered_map<int,int> ans;//答案
unordered_map<int,no> pre;//上一次时间
inline bool cmp(no a,no b){
    return a.a*60*60+a.b*60+a.c<b.a*60*60+b.b*60+b.c;
}//关系
inline int fff(char ch){
    return ch^'0';
}//转为整数
inline string prev(string s){
    int y=fff(s[0])*1000+fff(s[1])*100+fff(s[2])*10+fff(s[3]),m=fff(s[4])*10+fff(s[5]),d=fff(s[6])*10+fff(s[7]);
    if(d==1){
        --m;
        if(m==0)
            ++y,m=12;
        d=ee[m];
    } else
        ++d;
    string aaa=to_string(y);
    string bbb=to_string(m);
    if(bbb.size()==1)
        aaa+='0';
    aaa+=bbb;
    bbb=to_string(d);
    if(bbb.size()==1)
        aaa+='0';
    aaa+=bbb;
    return aaa;
}
inline int orz(no a){
    return a.a*60*60+a.b*60+a.c;
}//判断当天已经过去的秒数
inline bool check(no a,no b){
    if(a.s==b.s){
        if(sub(b,a)<6*60*60)
            return 0;
        return 1;
    } else{
        if(a.s!=prev(b.s))
            return 1;
        if(24*60*60-orz(a)+orz(b)<6*60*60)
            return 0;
        return 1;
    }
}
int n,m;
inline int read(){
    int res=0,f=0;
    char ch=getchar();
    while(ch<'0'||ch>'9'){
        f|=(ch=='-');
        ch=getchar();
    }
    while(ch>='0'&&ch<='9'){
        res=(res<<1)+(res<<3)+fff(ch);
        ch=getchar();
    }
    return f?-res:res;
}//输入
inline int ask(int a,int b){
    return a*60+b;
}//转化时间
signed main(){
    n=read();
    for(int i=1;i<=n;++i){
        int x;
        node y;
        x=read();
        aaaa[i]=x;
        y.qwq=getchar();
        while(y.qwq!='M'&&y.qwq!='F')
            y.qwq=getchar();
        y.s=read(),y.a=read(),y.b=read();
        y.qaq=getchar();
        while(y.qaq!='P'&&y.qaq!='F')
            y.qaq=getchar();
        y.f=read(),y.c=read();
        ans[x]=y.s+y.f;
        y.e=0;
        if(y.qaq=='P')
            ans[x]+=10;//体质测试
        int ccc=ask(y.a,y.b);
        if(y.qwq=='M'){//男
            if(ccc<=ask(12,30))
                ans[x]+=20;
            else if(ccc<=ask(13,0))
                ans[x]+=18;
            else if(ccc<=ask(13,30))
                ans[x]+=16;
            else if(ccc<=ask(14,0))
                ans[x]+=14;
            else if(ccc<=ask(14,30))
                ans[x]+=12;
            else if(ccc<=ask(15,10))
                ans[x]+=10;
            else if(ccc<=ask(15,50))
                ans[x]+=8;
            else if(ccc<=ask(16,30))
                ans[x]+=6;
            else if(ccc<=ask(17,10))
                ans[x]+=4;
            else if(ccc<=ask(18,0))
                ans[x]+=2;
        } else{
            if(ccc<=ask(6,40))
                ans[x]+=20;
            else if(ccc<=ask(6,57))
                ans[x]+=18;
            else if(ccc<=ask(7,14))
                ans[x]+=16;
            else if(ccc<=ask(7,31))
                ans[x]+=14;
            else if(ccc<=ask(7,50))
                ans[x]+=12;
            else if(ccc<=ask(8,5))
                ans[x]+=10;
            else if(ccc<=ask(8,20))
                ans[x]+=8;
            else if(ccc<=ask(8,35))
                ans[x]+=6;
            else if(ccc<=ask(8,50))
                ans[x]+=4;
            else if(ccc<=ask(9,0))
                ans[x]+=2;
        }//期末长跑测试
        mp[x]=y;
    }
    m=read();
    for(int i=1;i<=m;++i){
        nod x;
        x.st=read(),x.p=read(),x.h=read(),x.m=read(),x.s=read(),x.hh=read(),x.mm=read(),x.ss=read();
        scanf("%lf",&x.l);
        x.a=read(),x.b=read(),x.sum=read();
        x.st2=to_string(x.st);
        x.l2=x.l*1000;
        node y=mp[x.p];
        if(y.qwq=='M'){//男
            if(x.l2<3000)
                continue;
        } else{//女
            if(x.l2<1500)
                continue;
        }//距离
        no p={x.h,x.m,x.s,x.st2},q={x.hh,x.mm,x.ss,x.st2};
        double j=x.l2*1.0/sub(q,p);
        if(cmp(q,p))
            p.s=prev(p.s);//不在同一天
        if(j<2||j>5)
            continue;//平均速度
        j=x.l2*1.0/x.sum;
        if(j>1.5)
            continue;//步频
        if(ask(x.a,x.b)>ask(4,30))
            continue;//暂停时间
        if(!pre.count(x.p)){//没有前驱
            pre[x.p]=q;//更新前驱 
            ++mp[x.p].c;
            ++mp[x.p].e;//增加次数 
        } else{
    	    no o=pre[x.p];
    	    if(check(o,p)){
    	        pre[x.p]=q;//更新前驱 
    	        ++mp[x.p].c;
    	        ++mp[x.p].e;//增加次数 
    	    }
    	}
    }
    for(int i=1;i<=n;++i){
        int x=aaaa[i];
        int y=ans[x];
        node z=mp[x];
        if(z.c>=18)
            y+=5;
        else if(z.c>=15)
            y+=4;
        else if(z.c>=12)
            y+=3;
        else if(z.c>=9)
            y+=2;
        else if(z.c>=6)
            ++y;//出勤
        if(z.e>=21)
            y+=10;
        else if(z.e>=19)
            y+=9;
        else if(z.e>=17)
            y+=8;
        else if(z.e>=14)
            y+=7;
        else if(z.e>=11)
            y+=6;
        else if(z.e>=7)
            y+=4;
        else if(z.e>=3)
            y+=2;//阳光长跑
        printf("%lld %lld ",x,y);
        if(y>=95)
            puts("A");
        else if(y>=90)
            puts("A-");
        else if(y>=85)
            puts("B+");
        else if(y>=80)
            puts("B");
        else if(y>=77)
            puts("B-");
        else if(y>=73)
            puts("C+");
        else if(y>=70)
            puts("C");
        else if(y>=67)
            puts("C-");
        else if(y>=63)
            puts("D+");
        else if(y>=60)
            puts("D");
        else
            puts("F");//等级
    }
    return 0;
}
2022/2/11 16:17
加载中...