QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#790904 | #9749. 小凯的省奖之梦 | Foedere0 | WA | 1187ms | 3932kb | C++20 | 4.7kb | 2024-11-28 15:57:51 | 2024-11-28 15:57:57 |
Judging History
answer
#include <bits/stdc++.h>
#define endl '\n'
// #define int long long
using namespace std;
typedef pair<int, int> PII;
const int N = 510;
int n, m, q1, q2;
struct node
{
string id;
int a1, a2, a3, b1, b2, b3;
int sum;
int w1, w2;
} t[N], s[N];
struct node3
{
string id;
int d, d2;
} zy[N];
int j[4];
map<string, int> mp;
bool cmp(node x, node y)
{
if (x.a1 + x.a2 + x.a3 == y.a1 + y.a2 + y.a3)
{
if (x.a1 == y.a1)
return x.id < y.id;
return x.a1 > y.a1;
}
return x.a1 + x.a2 + x.a3 > y.a1 + y.a2 + y.a3;
}
bool cmp2(node3 x, node3 y)
{
return x.d > y.d;
}
bool cmp3(node x, node y)
{
if (x.b1 + x.b2 + x.b3 == y.b1 + y.b2 + y.b3)
{
if (x.b1 == y.b1)
return x.id < y.id;
return x.b1 > y.b1;
}
return x.b1 + x.b2 + x.b3 > y.b1 + y.b2 + y.b3;
}
bool cmp4(node x, node y)
{
if (x.w1 + x.w2 == y.w1 + y.w2)
{
if (x.sum == y.sum)
{
if (x.b1 + x.a1 == y.b1 + y.a1)
return x.id < y.id;
return x.b1 + x.a1 > y.b1 + y.a1;
}
return x.sum > y.sum;
}
return x.w1 + x.w2 > y.w1 + y.w2;
}
bool cmp5(node3 x, node3 y)
{
return x.d2 > y.d2;
}
int be1, be2;
int ans = 1e9;
void solve2(int o, int p)
{
for (int i = 1; i <= n; i++)
{
s[i] = t[i];
if (s[i].id == "crazyzhk")
s[i].a1 = o, s[i].b1 = p;
zy[i].id = s[i].id, zy[i].d = s[i].a1, zy[i].d2 = s[i].b1;
}
j[1] = n * 15 / 100;
j[2] = n * 25 / 100;
j[3] = n * 35 / 100;
// cout << j[1] << " " << j[2] << " " << j[3] << endl;
sort(s + 1, s + 1 + n, cmp);
sort(zy + 1, zy + 1 + n, cmp2);
int yi = zy[n * 25 / 100].d;
int er = zy[n * 45 / 100].d;
int san = zy[n * 75 / 100].d;
for (int i = 1; i <= n; i++)
{
if (zy[i].d >= yi)
mp[zy[i].id] = 1;
else if (zy[i].d >= er)
mp[zy[i].id] = 2;
else if (zy[i].d >= san)
mp[zy[i].id] = 3;
else
mp[zy[i].id] = 4;
}
for (int i = 1; i <= n; i++)
{
if (j[1] && mp[s[i].id] <= 1)
{
j[1]--;
s[i].w1 = 15;
}
else if (j[2] && mp[s[i].id] <= 2)
{
j[2]--;
s[i].w1 = 10;
}
else if (j[3] && mp[s[i].id] <= 3)
{
j[3]--;
s[i].w1 = 5;
}
else
s[i].w1 = 0;
}
mp.clear();
j[1] = n * 15 / 100;
j[2] = n * 25 / 100;
j[3] = n * 35 / 100;
// cout << j[1] << " " << j[2] << " " << j[3] << endl;
sort(s + 1, s + 1 + n, cmp3);
sort(zy + 1, zy + 1 + n, cmp5);
yi = zy[n * 25 / 100].d2;
er = zy[n * 45 / 100].d2;
san = zy[n * 75 / 100].d2;
// cout << yi << " " << er << " " << san << endl;
for (int i = 1; i <= n; i++)
{
if (zy[i].d2 >= yi)
mp[zy[i].id] = 1;
else if (zy[i].d2 >= er)
mp[zy[i].id] = 2;
else if (zy[i].d2 >= san)
mp[zy[i].id] = 3;
else
mp[zy[i].id] = 4;
}
for (int i = 1; i <= n; i++)
{
// cout << s[i].id << " " << mp[s[i].id] << endl;
if (j[1] && mp[s[i].id] <= 1)
{
j[1]--;
s[i].w2 = 15;
}
else if (j[2] && mp[s[i].id] <= 2)
{
j[2]--;
s[i].w2 = 10;
}
else if (j[3] && mp[s[i].id] <= 3)
{
j[3]--;
s[i].w2 = 5;
}
else
s[i].w2 = 0;
}
sort(s + 1, s + 1 + n, cmp4);
for (int i = 1; i <= m; i++)
{
if (s[i].id == "crazyzhk")
{
ans = min(ans, (o - be1) * q1 + (p - be2) * q2);
}
}
}
void solve()
{
cin >> n;
for (int i = 1; i <= n; i++)
{
cin >> t[i].id >> t[i].a1 >> t[i].a2 >> t[i].a3 >> t[i].b1 >> t[i].b2 >> t[i].b3;
t[i].sum = t[i].a1 + t[i].a2 + t[i].a3 + t[i].b1 + t[i].b2 + t[i].b3;
if (t[i].id == "crazyzhk")
be1 = t[i].a1, be2 = t[i].b1;
}
cin >> m >> q1 >> q2;
//cout << be1 << " " << be2 << endl;
for (int o = be1; o <= 100; o++)
{
for (int p = be2; p <= 100; p++)
{
mp.clear();
solve2(o, p);
}
}
if (ans == 1e9)
{
cout << "Surely next time" << endl;
}
else
cout << ans << endl;
}
signed main()
{
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
int T = 1;
// cin >> T;
while (T--)
solve();
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 6ms
memory: 3724kb
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: 4ms
memory: 3592kb
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: 5ms
memory: 3932kb
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: -100
Wrong Answer
time: 1187ms
memory: 3672kb
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:
4661
result:
wrong answer 1st lines differ - expected: '2455', found: '4661'