QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#863333#9749. 小凯的省奖之梦xjt05TL 1902ms5632kbC++237.4kb2025-01-19 16:03:052025-01-19 16:03:05

Judging History

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

  • [2025-01-19 16:03:05]
  • 评测
  • 测评结果:TL
  • 用时:1902ms
  • 内存:5632kb
  • [2025-01-19 16:03:05]
  • 提交

answer

#include<iostream>
#include<queue>
#include<map>
#include<set>
#include<vector>
#include<algorithm>
#include<deque>
#include<cctype>
#include<string.h>
#include<math.h>
#include<time.h>
#include<random>
#include<stack>
#include<string>
#include<functional>
//#include <ext/pb_ds/assoc_container.hpp>
//#include <ext/pb_ds/tree_policy.hpp>
//#include<bits/stdc++.h>
#include <unordered_map>
#define ll          int 
#define lowbit(x) (x & -x)
#define endl "\n"//                           交互题记得删除
using namespace std;
void fio()
{
    ios::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
}
struct s
{
    string name;
    ll a[4];
    ll z1 = 0;//综测
    ll z2 = 0;
    ll b[4];
    ll sum = 0;
}p[25000];
bool cmp1(s x, s y)
{
    if (x.z1 != y.z1)
        return x.z1 > y.z1;
    else if (x.a[1] != y.a[1])
        return x.a[1] > y.a[1];
    else return x.name < y.name;
}
bool cmp2(s x, s y)
{
    if (x.z2 != y.z2)
        return x.z2 > y.z2;
    else if (x.b[1] != y.b[1])
        return x.b[1] > y.b[1];
    else return x.name < y.name;
}
bool cmpz2(s x, s y)
{
    return x.b[1] > y.b[1];
}
bool cmpz1(s x, s y)
{
    return x.a[1] > y.a[1];
}
bool cp(s x, s y)
{
    if (x.sum != y.sum)
        return x.sum > y.sum;
    else if (x.z1 + x.z2 != y.z1 + y.z2)
        return x.z1 + x.z2 > y.z1 + y.z2;
    else if (x.a[1] + x.b[1] != y.a[1] + y.b[1])
        return x.a[1] + x.b[1] > y.b[1] + y.a[1];
    else return x.name < y.name;
}
inline int read() {
    int x = 0, f = 0;
    char c = getchar();
    while (c > 57 || c < 48) {
        f |= c == 45;
        c = getchar();
    }
    while (c <= 57 && c >= 48) {
        x = (x << 3) + (x << 1) + c - 48;
        c = getchar();
    }
    return f ? -x : x;
}
int main()
{
   // fio();
    ll t;
    t = 1;
    while (t--)
    {
        ll n;
        n=read();
       ll l1 = (ll)(double(n) * 0.15);
        ll l2 = (ll)(double(n) * 0.25);
        ll l3 = (ll)(double(n) * 0.35);
        ll u1;
        ll u2;
        ll u3;
        ll d1, d2;
        ll u4;
        for (ll i = 1; i <= n; i++)//智,德,体
        {
            string f;
            cin >> f;
            p[i].name = f;
            ll x;
            for (ll j = 1; j <= 3; j++)
            {
                x=read();
                p[i].a[j] = x;
                p[i].z1 += x;
            }
            for (ll j = 1; j <= 3; j++)
            {
                x=read();
                p[i].b[j] = x;
                p[i].z2 += x;
            }
            if (p[i].name == "crazyzhk")
                u1 = 100 - p[i].a[1], u2 = 100 - p[i].b[1], u3 = p[i].a[1], u4 = p[i].b[1], d1 = p[i].z1, d2 = p[i].z2;
        }
        ll f, q, m;
        m=read();
        f=read();
        q=read();
        ll ans = 4e8;
        vector<ll>g;
        ll of = 0;
        for (ll i = 0; i <= u1; i++)
        {
            for (ll j = 0; j <= u2; j++)
            {
                if (i == u1 && j == u2)
                {
                    of = 1;
                }
                g.clear();
                map<ll, ll>e;
                ll cnt = f * i + q * j;
                for (ll z = 1; z <= n; z++)
                {
                    if (p[z].name == "crazyzhk")
                    {
                        p[z].z1 = d1 + i;
                        p[z].z2 = d2 + j;
                        p[z].a[1] = u3 + i, p[z].b[1] = u4 + j;
                        break;
                    }
                }
                //15 10 5
              //  sort(p+1,p+1+n,cmp1);
                for (ll z = 1; z <= n; z++)
                {
                    p[z].sum = 0;
                }
                sort(p + 1, p + 1 + n, cmpz1);
                for (ll z = 1; z <= n; z++)
                {
                    e[p[z].a[1]]++;
                    g.push_back(p[z].a[1]);
                }
                ll r1 = (ll)((double)g.size() * 0.25);
                ll r2 = (ll)((double)g.size() * 0.45);
                ll r3 = (ll)((double)g.size() * 0.75);
                ll cn1 = l1, cn2 = l2, cn3 = l3;
                ll cs = 0;
                ll k1, k2, k3;
                for (auto j : g)
                {
                    cs++;
                    if (cs <= r1)
                    {
                        k1 = j;
                    }
                    else if (cs <= r2)
                    {
                        k2 = j;
                    }
                    else if (cs <= r3)
                    {
                        k3 = j;
                    }
                }
                sort(p + 1, p + 1 + n, cmp1);
                for (ll z = 1; z <= n; z++)
                {
                    if (p[z].a[1] >= k1 && cn1 > 0)
                    {
                        cn1--;
                        p[z].sum += 15;
                    }
                    else if (p[z].a[1] >= k2 && cn2 > 0)
                    {
                        cn2--;
                        p[z].sum += 10;
                    }
                    else if (p[z].a[1] >= k3 && cn3 > 0)
                    {
                        cn3--;
                        p[z].sum += 5;
                    }
                }
                /////////////////////////////////
                g.clear(); e.clear();
                sort(p + 1, p + 1 + n, cmpz2);
                for (ll z = 1; z <= n; z++)
                {
                    e[p[z].b[1]]++;
                  
                        g.push_back(p[z].b[1]);
                }
                r1 = (ll)((double)g.size() * 0.25);
                r2 = (ll)((double)g.size() * 0.45);
                r3 = (ll)((double)g.size() * 0.75);
                cn1 = l1, cn2 = l2, cn3 = l3;
                cs = 0;
                for (auto j : g)
                {
                    cs++;
                    if (cs <= r1)
                    {
                        k1 = j;
                    }
                    else if (cs <= r2)
                    {
                        k2 = j;
                    }
                    else if (cs <= r3)
                    {
                        k3 = j;
                    }
                }
                sort(p + 1, p + 1 + n, cmp2);
                for (ll z = 1; z <= n; z++)
                {
                    if (p[z].b[1] >= k1 && cn1 > 0)
                    {
                        cn1--;
                        p[z].sum += 15;
                    }
                    else if (p[z].b[1] >= k2 && cn2 > 0)
                    {
                        cn2--;
                        p[z].sum += 10;
                    }
                    else if (p[z].b[1] >= k3 && cn3 > 0)
                    {
                        cn3--;
                        p[z].sum += 5;
                    }
                }
                sort(p + 1, p + 1 + n, cp);
                cs = 0;
                for (ll z= 1; z <= n; z++)
                {
                    cs++;
                    if (p[z].name == "crazyzhk" && cs <= m)
                    {
                        ans = min(ans, cnt);
                    }
                }

            }
        }
        if (ans == 4e8)
            cout << "Surely next time" << endl;
        else cout << ans << endl;
    }
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 7ms
memory: 5632kb

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: 5504kb

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: 3ms
memory: 5504kb

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: 1012ms
memory: 5632kb

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: 1902ms
memory: 5632kb

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: 5504kb

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: