QOJ.ac
QOJ
ID | Submission ID | Problem | Hacker | Owner | Result | Submit time | Judge time |
---|---|---|---|---|---|---|---|
#1465 | #863357 | #9749. 小凯的省奖之梦 | Dukerki | xjt05 | Failed. | 2025-01-19 17:09:01 | 2025-01-19 17:09:02 |
Details
Extra Test:
Accepted
time: 1ms
memory: 5760kb
input:
500 abcdefghijklmnopacaa 28 66 39 80 37 61 abcdefghijklmnopacab 55 20 92 6 73 49 abcdefghijklmnopacac 39 24 96 13 38 95 abcdefghijklmnopacad 83 40 72 76 41 17 abcdefghijklmnopacae 78 44 34 40 98 59 abcdefghijklmnopacaf 14 93 41 71 51 35 abcdefghijklmnopacag 30 26 74 79 68 99 abcdefghijklmnopacah 75 ...
output:
0
result:
ok single line: '0'
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#863357 | #9749. 小凯的省奖之梦 | xjt05 | AC ✓ | 2808ms | 5632kb | C++23 | 7.0kb | 2025-01-19 16:10:53 | 2025-01-19 16:10:57 |
answer
#include<iostream>
#include<map>
#include<vector>
#include<algorithm>
#include <unordered_map>
#define ll int
#define lowbit(x) (x & -x)
#define endl "\n"// 交互题记得删除
using namespace std;
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 = u1; i >=0; i--)
{
for (ll j = u2; j >= 0; j--)
{
ll pd=0;
if (i == u1 && j == u2)
{
of = 1;
}
g.clear();
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++)
{
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();
sort(p + 1, p + 1 + n, cmpz2);
for (ll z = 1; z <= n; z++)
{
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)
{
pd=1;
ans = min(ans, cnt);
}
}
if(pd==0)
break;
}
}
if (ans == 4e8)
cout << "Surely next time" << endl;
else cout << ans << endl;
}
}