大%你求调
查看原帖
大%你求调
475532
Alexandr楼主2024/10/11 11:41

tlq里的数据都过了,但是交上去 WA 0pts

调了好久了,dalao们帮帮哇

#include<bits/stdc++.h>
#define _rep(i,a,b) for(int i=(a);i<=(b);++i)
#define _antirep(i,a,b) for(int i=(a);i>=(b);--i)
#define In(x) freopen(x".in","r",stdin)
#define Out(x) freopen(x".out","w",stdout)
#define File(x) (In(x),Out(x)) 
using namespace std;
typedef long long LL;
typedef double db;
const int N=1e4+5; 
int n,m;
int id[N];
int score[N];//总得分
string xh[N];//学号
map<string,int>_xh;//转为学号
bool xb[N];//0男 1女
int cnt1[N],cnt2[N];//cnt1阳光长跑 cnt2出勤次数 
int lst_month[N],lst_day[N],lst_hour[N],lst_minite[N],lst_second[N];
int changes(int A,int B,int C)
{
    return A*3600+B*60+C;
}
bool cmp(int x,int y)
{
    return xh[x]<xh[y];
}
bool check(int x,int y,int lstx,int lsty)//判断两天是否相邻
{
    if(lstx==1&&lsty==31)
    {
        if(x==2&&y==1) return true;
        return false;
    }
    if(lstx==2&&lsty==28)
    {
        if(x==3&&y==1) return true;
        return false;
    }
    if(lstx==3&&lsty==31)
    {
        if(x==4&&y==1) return true;
        return false;
    }
    if(lstx==4&&lsty==30)
    {
        if(x==5&&y==1) return true;
        return false;
    }
    if(lstx==5&&lsty==31)
    {
        if(x==6&&y==1) return true;
        return false;
    }
    if(lstx==6&&lsty==30)
    {
        if(x==7&&y==1) return true;
        return false;
    }
    if(lstx==7&&lsty==31)
    {
        if(x==8&&y==1) return true;
        return false;
    }
    if(lstx==8&&lsty==31)
    {
        if(x==9&&y==1) return true;
        return false;
    }
    if(lstx==9&&lsty==30)
    {
        if(x==10&&y==1) return true;
        return false;
    }
    if(lstx==10&&lsty==31)
    {
        if(x==11&&y==1) return true;
        return false;
    }
    if(lstx==11&&lsty==30)
    {
        if(x==12&&y==1) return true;
        return false;
    }
    if(lstx==12&&lsty==31)
    {
        if(x==1&&y==1) return true;
        return false;
    }
    if(lstx==x)
    {
        if(y-lsty<=1) return true;
        return false;
    }
    return false;
}
signed main()
{  
    scanf("%d",&n);
    _rep(i,1,n)
    {
        char _xb,tz; string time; int f;
        cin>>xh[i]>>_xb; scanf("%d",&score[i]); cin>>time>>tz; scanf("%d%d",&f,&cnt2[i]);
        // input above
        score[i]+=f;
        if(tz=='P') score[i]+=10;
        _xh[xh[i]]=i;
        xb[i]=(_xb=='M'?0:1); 
        int minite=0,second=0,now=0,len=time.size();
        while(now<len&&(int)time[now]!=39) minite=minite*10+(time[now++]-'0'); now++;
        while(now<len&&(int)time[now]!=34) second=second*10+(time[now++]-'0'); 
        if(xb[i]==0)//男
        {
            int second_big=minite*60+second; 
            if(second_big<=12*60+30) score[i]+=20;
            else if(second_big<=13*60) score[i]+=18;
            else if(second_big<=13*60+30) score[i]+=16;
            else if(second_big<=14*60) score[i]+=14;
            else if(second_big<=14*60+30) score[i]+=12;
            else if(second_big<=15*60+10) score[i]+=10;
            else if(second_big<=15*60+50) score[i]+=8;
            else if(second_big<=16*60+30) score[i]+=6;
            else if(second_big<=17*60+10) score[i]+=4;
            else if(second_big<=18*60) score[i]+=2;
        }
        if(xb[i]==1)//女
        {
            int second_big=minite*60+second;
            if(second_big<=6*60+40) score[i]+=20;
            else if(second_big<=6*60+57) score[i]+=18;
            else if(second_big<=7*60+14) score[i]+=16;
            else if(second_big<=7*60+31) score[i]+=14;
            else if(second_big<=7*60+50) score[i]+=12;
            else if(second_big<=8*60+5) score[i]+=10;
            else if(second_big<=8*60+20) score[i]+=8;
            else if(second_big<=8*60+35) score[i]+=6;
            else if(second_big<=8*60+50) score[i]+=4;
            else if(second_big<=9*60) score[i]+=2;
        } 
    } 
    cin>>m;
    _rep(op,1,m)
    {
        bool flag=false;
        string date,student,time1,time2,rest; db S; int step;
        cin>>date>>student>>time1>>time2; scanf("%lf",&S); cin>>rest; scanf("%d",&step); 
        int i=_xh[student];
        int month=(date[4]-'0')*10+(date[5]-'0'),day=(date[6]-'0')*10+(date[7]-'0'); 
        //处理运动总时间
        int t1_hours=0,t1_minites=0,t1_seconds=0;
        int t2_hours=0,t2_minites=0,t2_seconds=0;
        int now1=0,now2=0,len1=time1.size(),len2=time2.size();
        while(now1<len1&&time1[now1]!=':') t1_hours=t1_hours*10+(time1[now1++]-'0');now1++;
        while(now1<len1&&time1[now1]!=':') t1_minites=t1_minites*10+(time1[now1++]-'0');now1++;
        while(now1<len1) t1_seconds=t1_seconds*10+(time1[now1++]-'0');
        while(now2<len2&&time2[now2]!=':') t2_hours=t2_hours*10+(time2[now2++]-'0');now2++;
        while(now2<len2&&time2[now2]!=':') t2_minites=t2_minites*10+(time2[now2++]-'0');now2++;
        while(now2<len2) t2_seconds=t2_seconds*10+(time2[now2++]-'0');
        int Time_second=changes(t2_hours,t2_minites,t2_seconds)-changes(t1_hours,t1_minites,t1_seconds);
        //处理休息时间
        int rest_minites=0,rest_seconds=0,Len=rest.size(),now=0;
        while(now<Len&&(int)rest[now]!=39) rest_minites=rest_minites*10+(rest[now++]-'0');now++;
        while(now<Len&&(int)rest[now]!=34) rest_seconds=rest_seconds*10+(rest[now++]-'0');
        int Rest_second=rest_minites*60+rest_seconds;
        if(check(month,day,lst_month[i],lst_day[i])) 
        {
            int new_t1_hours=t1_hours+(day!=lst_day[i]?24:0);
            int new_t1_minites=t1_minites;
            int new_t1_seconds=t1_seconds;  
            if(changes(new_t1_hours,new_t1_minites,new_t1_seconds)-changes(lst_hour[i],lst_minite[i],lst_second[i])>=6*3600
            &&S>=(!xb[i]?3:1.5)&&S*1000>=2*Time_second&&S*1000<=5*Time_second&&Rest_second<=4*60+30&&S*1000<=1.5*step) 
                cnt1[i]++,flag=true;//,cout<<i<<" "<<op<<endl; 
        }
        else if(S>=(!xb[i]?3:1.5)&&S*1000>=2*Time_second&&S*1000<=5*Time_second&&Rest_second<=4*60+30&&S*1000<=1.5*step) 
            cnt1[i]++,flag=true;//,cout<<i<<" "<<op<<endl; 
        if(flag)
        {
            lst_month[i]=month;
            lst_day[i]=day;
            lst_hour[i]=t2_hours;
            lst_minite[i]=t2_minites;
            lst_second[i]=t2_seconds; 
        } 
    }
    _rep(i,1,n) cnt2[i]+=cnt1[i];  
    _rep(i,1,n)
    {
        if(cnt1[i]>=3&&cnt1[i]<=6) score[i]+=2;
        else if(cnt1[i]>=7&&cnt1[i]<=10) score[i]+=4;
        else if(cnt1[i]>=11&&cnt1[i]<=13) score[i]+=6;
        else if(cnt1[i]>=14&&cnt1[i]<=16) score[i]+=7;
        else if(cnt1[i]>=17&&cnt1[i]<=18) score[i]+=8;
        else if(cnt1[i]>=19&&cnt1[i]<=20) score[i]+=9;
        else if(cnt1[i]>=21) score[i]+=10;
    }
    _rep(i,1,n)
    {
        if(cnt2[i]>=6&&cnt2[i]<=8) score[i]+=1;
        else if(cnt2[i]>=9&&cnt2[i]<=11) score[i]+=2;
        else if(cnt2[i]>=12&&cnt2[i]<=14) score[i]+=3;
        else if(cnt2[i]>=15&&cnt2[i]<=17) score[i]+=4;
        else if(cnt2[i]>=18) score[i]+=5;
    } 
    _rep(i,1,n) id[i]=i;
    sort(id+1,id+n+1,cmp);
    _rep(p,1,n)
    {
        int i=id[p];
        cout<<xh[i]<<" "<<score[i]<<" ";
        if(score[i]>=95&&score[i]<=100) cout<<"A\n";
        else if(score[i]>=90&&score[i]<95) cout<<"A-\n";
        else if(score[i]>=85&&score[i]<90) cout<<"B+\n";
        else if(score[i]>=80&&score[i]<85) cout<<"B\n";
        else if(score[i]>=77&&score[i]<80) cout<<"B-\n";
        else if(score[i]>=73&&score[i]<77) cout<<"C+\n";
        else if(score[i]>=70&&score[i]<73) cout<<"C\n";
        else if(score[i]>=67&&score[i]<70) cout<<"C-\n";
        else if(score[i]>=63&&score[i]<67) cout<<"D+\n";
        else if(score[i]>=60&&score[i]<63) cout<<"D\n";
        else cout<<"F\n";
    }
    return 0;
}

写的很屎臭唉:(

2024/10/11 11:41
加载中...