期望得分:100+40+0

实际得分:0+40+0

awa(我讨厌大模拟!!!

T1:沙雕大模拟!!!ccc

题面如下:

校内模拟赛  ———  2019.10.31 7:40至11.10校内模拟赛  ———  2019.10.31 7:40至11.10

 

 

思路:直接模拟着做呗,注意一定要细心!耐心!认真!!!!!

我的零蛋代码:(零蛋还好意思贴出来?!)

#include<cstdio>
#include<cstring>
#include<iostream>
#include<algorithm>
using namespace std;
const int inf=100001;
int N,M,T,P,Q;
struct node {
    int id,val,weizhi;
    char name[16],x[5];
} A[100005],B[100005];
int tota[6],totb[6];
int topa[6],topb[6];
int sa[6],sb[6];
int ca[100005],cb[100006];
inline int read() {
    int s=0,w=1;
    char ch=getchar();
    while(ch<'0'||ch>'9') {
        if(ch=='-')w=-1;
        ch=getchar();
    }
    while(ch>='0'&&ch<='9')
        s=(s<<3)+(s<<1)+(ch^48),ch=getchar();
    return s*w;
}
bool cmp(node a,node b) {
    if(a.weizhi!=b.weizhi)return a.weizhi<b.weizhi;
    return a.val>b.val;
}
void finda() {
    int k,z=-inf,l=0;
    for(int i=1; i<=5; i++) {
        if(tota[i]==1)continue;
        if(topa[i]==topa[i+1]-1)continue;
//        if(ca[i]==inf)continue;
        if(topa[i]+1>N)continue;
        if(ca[topa[i]+1]>z) z=ca[topa[i]+1],k=topa[i]+1,l=i;
        if(ca[topa[i]+1]==z&&A[topa[i]+1].id<A[k].id)z=ca[topa[i]+1],k=topa[i]+1,l=i;
    }
    topa[l]++;
    cout<<"Substitution by A,No."<<A[k].id<<" "<<A[k].name<<" is coming up to change No.";
    cout<<A[k-1].id<<" "<<A[k-1].name<<".\n";
}

void findb() {
    int k,z=-inf,l=0;
    for(int i=1; i<=5; i++) {
        if(totb[i]==1)continue;
        if(topb[i]+1==topb[i+1])continue;
//        if(cb[topb[i]]==inf)continue;
        if(topb[i]+1>M)continue;
        if(cb[topb[i]+1]>z)z=cb[topb[i]+1],k=topb[i]+1,l=i;
        if(cb[topb[i]+1]==z&&B[topb[i]+1].id<B[k].id)z=cb[topb[i]+1],k=topb[i]+1,l=i;
    }
    topb[l]++;
    cout<<"Substitution by B,No."<<B[k].id<<" "<<B[k].name<<" is coming up to change No."<<B[k-1].id<<" "<<B[k-1].name<<".\n";
}
void awa();
void init();
int main() {
//    freopen("match.in","r",stdin);
//    freopen("match.out","w",stdout);
    init();
    sort(A+1,A+1+N,cmp);
    sort(B+1,B+1+M,cmp);
    awa();
    for(int i=1; i<T; i++) {
        if(i%P&&i%Q)continue;
        if(i%P==0) finda();
        if(i%Q==0) findb();
    }
//    fclose stdin;
//    fclose stdout;
    return 0;
}
void init() {
    N=read(),M=read(),T=read(),P=read(),Q=read();
    for(int i=1; i<=N; i++) {
        cin>>A[i].name;
        A[i].id=read();
        cin>>A[i].x+1;
        if(A[i].x[1]=='p'&&A[i].x[2]=='g')A[i].weizhi=1;
        if(A[i].x[1]=='s'&&A[i].x[2]=='g')A[i].weizhi=2;
        if(A[i].x[1]=='s'&&A[i].x[2]=='f')A[i].weizhi=3;
        if(A[i].x[1]=='p'&&A[i].x[2]=='f')A[i].weizhi=4;
        if(A[i].x[1]=='c')A[i].weizhi=5;
        A[i].val=read();
    }
    for(int i=1; i<=M; i++) {
        cin>>B[i].name;
        B[i].id=read();
        cin>>B[i].x+1;
        if(B[i].x[1]=='p'&&B[i].x[2]=='g')B[i].weizhi=1;
        if(B[i].x[1]=='s'&&B[i].x[2]=='g')B[i].weizhi=2;
        if(B[i].x[1]=='s'&&B[i].x[2]=='f')B[i].weizhi=3;
        if(B[i].x[1]=='p'&&B[i].x[2]=='f')B[i].weizhi=4;
        if(B[i].x[1]=='c')B[i].weizhi=5;
        B[i].val=read();
    }
}
void awa() {
    for(int i=1; i<=N; i++) {
        tota[A[i].weizhi]++;
        if(A[i].weizhi!=A[i-1].weizhi)topa[A[i].weizhi]=i;
    }
    for(int i=1; i<=M; i++) {
        totb[B[i].weizhi]++;
        if(B[i].weizhi!=B[i-1].weizhi)topb[B[i].weizhi]=i;
    }
    for(int i=1; i<=N; i++)
        ca[i]=A[i].val-A[i-1].val;
    for(int i=1; i<=M; i++)
        cb[i]=B[i].val-B[i-1].val;
    return ;
}
View Code

相关文章:

  • 2021-08-18
  • 2021-10-01
  • 2021-05-17
  • 2021-07-11
  • 2021-12-16
  • 2022-02-18
  • 2021-10-17
  • 2021-12-29
猜你喜欢
  • 2021-06-22
  • 2022-02-02
  • 2021-06-12
  • 2021-07-25
  • 2021-09-16
  • 2022-02-14
  • 2021-12-02
相关资源
相似解决方案