QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#789069 | #9749. 小凯的省奖之梦 | isWFnoya | WA | 501ms | 144796kb | C++20 | 2.6kb | 2024-11-27 19:13:05 | 2024-11-27 19:13:07 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef pair<ll,ll> PII;
const int N=1e6+10,mod=1e9+7;
char s[N];
int n,m,p,q;
typedef struct{
string name;
int zy1,dy1,ty1,zy2,dy2,ty2,zc1,zc2;
int jx;
}Node;
bool cmp(Node &nd1,Node &nd2){
if(nd1.jx!=nd2.jx) return nd1.jx>nd2.jx;
if(nd1.zc1+nd1.zc2!=nd2.zc1+nd2.zc2) return nd1.zc1+nd1.zc2>nd2.zc1+nd2.zc2;
if(nd1.zy1+nd1.zy2!=nd2.zy1+nd2.zy2) return nd1.zy1+nd1.zy2>nd2.zy1+nd2.zy2;
return nd1.name>nd2.name;
}
bool cmp2(Node &nd1,Node &nd2){
if(nd1.zc1!=nd2.zc1) return nd1.zc1>nd2.zc1;
return nd1.name>nd2.name;
}
bool cmp3(Node &nd1,Node &nd2){
if(nd1.zc2!=nd2.zc2) return nd1.zc2>nd2.zc2;
return nd1.name>nd2.name;
}
Node e1[N],e2[N];
int cnt1,cnt2,cnt3;
bool check(){
int c1=cnt1,c2=cnt2,c3=cnt3;
for(int i=1;i<=n;i++) e2[i]=e1[i];
for(int i=1;i<=n;i++){
e2[i].zc1=e2[i].zy1+e2[i].dy1+e2[i].ty1;
e2[i].zc2=e2[i].zy2+e2[i].dy2+e2[i].ty2;
}
sort(e2+1,e2+1+n,cmp2);
for(int i=1;i<=n;i++){
int res=1;
for(int j=1;j<=n;j++){
if(e2[j].zy1>e2[i].zy1) res++;
}
if(c1!=0&&res<=floor(0.25*n)){
c1--;
e2[i].jx+=15;
continue;
}
if(c2!=0&&res<=floor(0.45*n)){
c2--;
e2[i].jx+=10;
continue;
}
if(c3!=0&&res<=floor(0.75*n)){
c3--;
e2[i].jx+=5;
}
}
sort(e2+1,e2+1+n,cmp3);
c1=cnt1,c2=cnt2,c3=cnt3;
for(int i=1;i<=n;i++){
int res=1;
for(int j=1;j<=n;j++){
if(e2[j].zy2>e2[i].zy2) res++;
}
if(c1!=0&&res<=floor(0.25*n)){
c1--;
e2[i].jx+=15;
continue;
}
if(c2!=0&&res<=floor(0.45*n)){
c2--;
e2[i].jx+=10;
continue;
}
if(c3!=0&&res<=floor(0.75*n)){
c3--;
e2[i].jx+=5;
}
}
// for(int j=1;j<=n;j++){
// cout<<e2[j].name<<" "<<e2[j].jx<<" "<<e2[j].zc1+e2[j].zc2<<" "<<e2[j].zy1+e2[j].zy2<<endl;
// }
sort(e2+1,e2+1+n,cmp);
for(int i=1;i<=m;i++){
if(e2[i].name=="crazyzhk") return true;
}
return false;
}
void __(){
cin>>n;
int id=0;
for(int i=1;i<=n;i++){
string s;
int a,b,c,d,e,f;
cin>>s>>a>>b>>c>>d>>e>>f;
e1[i]={s,a,b,c,d,e,f};
if(s=="crazyzhk") id=i;
}
cnt1=floor(0.15*n);
cnt2=floor(0.25*n);
cnt3=floor(0.35*n);
cin>>m>>p>>q;
int ans=1e9;
int mx1=e1[id].zy1,mx2=e1[id].zy2;
for(int i=0;i<=100-mx1;i++){
for(int j=0;j<=100-mx2;j++){
e1[id].zy1=mx1+i,e1[id].zy2=mx2+j;
// cout<<i<<" "<<j<<endl;
if(check()) ans=min(ans,p*i+q*j);
}
}
if(ans>1e8) cout<<"Surely next time"<<endl;
else cout<<ans<<endl;
}
int main(){
int _=1;
// cin>>_;
while(_--){
__();
}
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 15ms
memory: 144400kb
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: 15ms
memory: 144300kb
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: 7ms
memory: 144796kb
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: 222ms
memory: 144248kb
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: 501ms
memory: 144252kb
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: -100
Wrong Answer
time: 11ms
memory: 144212kb
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:
1334
result:
wrong answer 1st lines differ - expected: '539', found: '1334'