QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#803167#9749. 小凯的省奖之梦EvanTL 788ms3844kbC++234.4kb2024-12-07 16:16:412024-12-07 16:16:42

Judging History

你现在查看的是最新测评结果

  • [2024-12-07 16:16:42]
  • 评测
  • 测评结果:TL
  • 用时:788ms
  • 内存:3844kb
  • [2024-12-07 16:16:41]
  • 提交

answer

#pragma GCC optimize("O2")
#pragma GCC optimize("O3")

#include<bits/stdc++.h>
using namespace std;

int n,m,tt;
string name="crazyzhk";

typedef struct{
    int a,b,c,sum,r;
    string s;
}o;

typedef struct{
    int sum,a,rr;
    string s;
}O;

bool cmp1(o x,o y)
{
    if(x.sum!=y.sum)
    {
        return x.sum>y.sum;
    }
    if(x.a!=y.a)
    {
        return x.a>y.a;
    }
    return x.s<y.s;
}

bool cmp3(o x,o y)
{
    return x.a>y.a;
}

bool cmp2(O x,O y)
{
    if(x.rr!=y.rr)
    {
        return x.rr>y.rr;
    }
    if(x.sum!=y.sum)
    {
        return x.sum>y.sum;
    }
    if(x.a!=y.a)
    {
        return x.a>y.a;
    }
    return x.s<y.s;
}


vector<o> s1,s2;
vector<o> ss1,ss2;
int check(int a1,int a2)
{
    map<string,int> mp;
    int t1=(0.15*n),t2=(0.25*n),t3=(0.35*n);
    for(int i=0;i<n;i++)
    {
        if(s1[i].s==name)
        {
            s1[i].a=a1;
            s1[i].sum=s1[i].a+s1[i].b+s1[i].c;
        }
    }
    sort(s1.begin(),s1.end(),cmp3);
    int be=-1;
    for(int i=0;i<n;i++)
    {
        if(s1[i].a==be){s1[i].r=s1[i-1].r;}
        else{be=s1[i].a;s1[i].r=i+1;}
    }
    sort(s1.begin(),s1.end(),cmp1);
    vector<int> is(n+10);
    int cnt=0;
    for(int i=0;i<n;i++)
    {
        if(cnt==t1){break;}
        if(!is[i]&&1.0*s1[i].r/n<=0.25+1e-6)
        {
            mp[s1[i].s]+=15;
            cnt++;
            is[i]=1;
        }
    }
    cnt=0;
    for(int i=0;i<n;i++)
    {
        if(cnt==t2){break;}
        if(!is[i]&&1.0*s1[i].r/n<=0.45+1e-6)
        {
            mp[s1[i].s]+=10;
            cnt++;
            is[i]=1;
        }
    }
    cnt=0;
    for(int i=0;i<n;i++)
    {
        if(cnt==t3){break;}
        if(!is[i]&&1.0*s1[i].r/n<=0.75+1e-6)
        {
            mp[s1[i].s]+=5;
            cnt++;
            is[i]=1;
        }
    }
    cnt=0;
    // --------------------
    for(int i=0;i<n;i++)
    {
        if(s2[i].s==name)
        {
            s2[i].a=a2;
            s2[i].sum=s2[i].a+s2[i].b+s2[i].c;
        }
    }
    sort(s2.begin(),s2.end(),cmp3);
    be=-1;
    for(int i=0;i<n;i++)
    {
        if(s2[i].a==be){s2[i].r=s2[i-1].r;}
        else{be=s2[i].a;s2[i].r=i+1;}
    }
    sort(s2.begin(),s2.end(),cmp1);
    for(int i=0;i<n;i++){is[i]=0;}
    cnt=0;
    for(int i=0;i<n;i++)
    {
        if(cnt==t1){break;}
        if(!is[i]&&1.0*s2[i].r/n<=0.25+1e-6)
        {
            mp[s2[i].s]+=15;
            cnt++;
            is[i]=1;
        }
    }
    cnt=0;
    for(int i=0;i<n;i++)
    {
        if(cnt==t2){break;}
        if(!is[i]&&1.0*s2[i].r/n<=0.45+1e-6)
        {
            mp[s2[i].s]+=10;
            cnt++;
            is[i]=1;
        }
    }
    cnt=0;
    for(int i=0;i<n;i++)
    {
        if(cnt==t3){break;}
        if(!is[i]&&1.0*s2[i].r/n<=0.75+1e-6)
        {
            mp[s2[i].s]+=5;
            cnt++;
            is[i]=1;
        }
    }
    cnt=0;
    vector<O> w2(n);
    for(int i=0;i<n;i++)
    {
        w2[i].s=ss1[i].s;
        w2[i].rr=mp[ss1[i].s];
        w2[i].sum=ss1[i].sum+ss2[i].sum;
        w2[i].a=ss1[i].a+ss2[i].a;
        if(i==tt)
        {
            w2[i].a=a1+a2;
            w2[i].sum=a1+a2+ss1[i].b+ss1[i].c+ss2[i].b+ss2[i].c;
        }
    }
    sort(w2.begin(),w2.end(),cmp2);
    for(int i=0;i<m;i++)
    {
        if(w2[i].s==name){return 1;}
    }
    return 0;
}

int main()
{
    ios::sync_with_stdio(false);
	cin.tie(nullptr);cout.tie(nullptr);
    int p,q,a1,a2;
    cin >> n;
    s1.resize(n);s2.resize(n);
    ss1.resize(n);ss2.resize(n);
    for(int i=0;i<n;i++)
    {
        cin >> s1[i].s >> s1[i].a >> s1[i].b >> s1[i].c;
        s1[i].sum = s1[i].a + s1[i].b + s1[i].c;
        
        s2[i].s=s1[i].s;
        cin >> s2[i].a >> s2[i].b >> s2[i].c;
        s2[i].sum = s2[i].a + s2[i].b + s2[i].c;
        
        if(s1[i].s==name){tt=i;a1=s1[i].a;a2=s2[i].a;}
        ss1[i]=s1[i];ss2[i]=s2[i];
    }

    cin >> m >> p >> q;
    if(check(100,100)==0){cout << "Surely next time\n";return 0;}
    int ans=2E9;
    for(int i=a1;i<=100;i++)
    {
        for(int j=a2;j<=100;j++)
        {
            if(check(i,j))
            {
                ans=min(ans,(i-a1)*p+(j-a2)*q);
                break;
            }
        }
    }
    cout << ans << "\n";
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 6ms
memory: 3844kb

input:

8
easycxk 94 12 77 74 70 55
hardzhk 80 80 95 96 20 60
crazyzhk 40 49 36 50 50 74
mike 50 98 93 36 90 23
amy 50 81 59 53 100 50
tom 50 71 69 53 90 60
john 65 73 41 60 34 69
jyy 12 26 29 29 53 50
2 44 14

output:

1494

result:

ok single line: '1494'

Test #2:

score: 0
Accepted
time: 3ms
memory: 3628kb

input:

7
a 30 61 27 94 20 70
b 64 57 68 8 43 34
c 97 66 94 33 79 42
crazyzhk 59 6 29 55 43 53
e 65 78 61 71 31 2
f 62 25 95 60 52 44
g 60 90 30 62 42 54
2 72 22

output:

858

result:

ok single line: '858'

Test #3:

score: 0
Accepted
time: 0ms
memory: 3660kb

input:

8
amy 94 12 77 100 70 55
hardzhk 90 80 95 96 20 60
john 90 39 16 70 50 74
mike 100 98 93 90 90 23
easycxk 70 81 59 73 100 50
ydzlhzs 100 85 89 100 90 60
crazyzhk 65 13 11 60 14 19
jyy 92 26 29 69 53 80
2 44 14

output:

Surely next time

result:

ok single line: 'Surely next time'

Test #4:

score: 0
Accepted
time: 788ms
memory: 3772kb

input:

188
w 81 4 91 44 6 8
apbyloihyqjcrekq 73 30 30 39 56 4
fbrzsl 95 54 54 82 41 28
vkngftis 72 22 22 47 43 33
kehgasflquvcjed 43 68 53 5 26 49
efzjky 55 59 17 100 5 14
czockbgeibdncwekuwrq 11 61 71 21 18 21
eselhjadzufeonshb 96 5 91 15 67 14
mrvwolins 17 99 70 94 66 72
ona 43 27 26 63 54 19
trtdyfunitu...

output:

2455

result:

ok single line: '2455'

Test #5:

score: 0
Accepted
time: 45ms
memory: 3724kb

input:

232
uqyuwsvjo 85 50 77 12 95 18
hsnouhhv 66 91 49 6 80 81
oihpvu 34 70 90 44 86 12
lmoorhpassjlgl 58 12 83 72 62 88
nwkpy 0 23 67 63 62 7
jge 79 6 18 49 1 87
cwcleucesshipsxw 88 57 56 80 45 50
uryopxfrbwfgkvuanzz 48 55 66 54 65 88
rsfuwcomkf 33 44 53 23 38 66
zcuonzdetqekrdcueie 86 31 80 19 91 70
cw...

output:

237

result:

ok single line: '237'

Test #6:

score: 0
Accepted
time: 1ms
memory: 3656kb

input:

6
crazyzhk 70 95 89 80 96 98
wwfrk 95 95 89 90 96 98
uzlcb 95 97 92 92 90 87
dfkzf 80 95 89 90 96 98
xiedz 95 95 89 90 96 98
aylzw 80 95 89 90 96 98
3 59 49

output:

539

result:

ok single line: '539'

Test #7:

score: -100
Time Limit Exceeded

input:

403
pesdaxzqzphhnmx 67 43 96 68 22 0
wcwrcduyjejilq 26 3 14 59 53 29
kleruyyey 87 44 81 73 40 10
rxhviwr 70 92 62 10 58 1
terblhbqhflab 33 26 90 7 70 51
icszh 4 78 11 17 27 3
ujuel 48 77 27 39 65 48
cgxqvk 7 43 64 87 91 43
fuevhkh 89 3 38 4 100 66
biwcpy 78 9 66 25 96 78
nuetocaoa 27 8 61 85 36 46
j...

output:


result: