ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#562 | #112. 【0621 模拟赛】7Krokods | zxh_qwq | 100 | 4ms | 3408kb | C++14 | 566b | 2025-06-21 14:24:00 | 2025-06-21 23:48:09 |
answer
#include<bits/stdc++.h>
using namespace std;
int t[256];
int calc(int k,int o,int r,int d){
int ks=min({k/2,o/2,d,r});
return k*k+o*o+r*r+d*d+ks*7;
}
int main(){
int n,m;
cin>>n>>m;
char c;
for(int i=1;i<=n;i++){
cin>>c;
t[c]++;
}
n+=m;
int ans=-1;
for(int cntk=t['k'];cntk<=n;cntk++){
for(int cnto=t['o'];cnto<=n-cntk;cnto++){
for(int cntr=t['r'];cntr<=n-cntk-cnto;cntr++){
for(int cntd=t['d'];cntd<=n-cntk-cnto-cntr;cntd++){
ans=max(ans,calc(cntk,cnto,cntr,cntd));
}
}
}
}
cout<<ans;
return 0;
}
Details
小提示:点击横条可展开更详细的信息
Subtask #1:
score: 17
Accepted
Test #1:
score: 17
Accepted
time: 0ms
memory: 3324kb
input:
56 0 kkkkkkkkkkoooooooooorrrrrdddddkkkkkkkkkkooooooooookkkkoo
output:
1145
result:
ok "1145"
Test #2:
score: 0
Accepted
time: 0ms
memory: 3288kb
input:
4 0 dkor
output:
4
result:
ok "4"
Test #3:
score: 0
Accepted
time: 0ms
memory: 3332kb
input:
11 0 krokodkroko
output:
44
result:
ok "44"
Test #4:
score: 0
Accepted
time: 0ms
memory: 3408kb
input:
10 0 kkkkkkkkkk
output:
100
result:
ok "100"
Test #5:
score: 0
Accepted
time: 1ms
memory: 3288kb
input:
100 0 krokodkrodkrokodkrodkrokodkrodkrokodkrodkrokodkrodkrokodkrodkrokodkrodkrokodkrodkrokodkrodkrok...
output:
2705
result:
ok "2705"
Subtask #2:
score: 26
Accepted
Test #6:
score: 26
Accepted
time: 1ms
memory: 3408kb
input:
8 1 kodrrrrr
output:
39
result:
ok "39"
Test #7:
score: 0
Accepted
time: 1ms
memory: 3340kb
input:
5 1 kroko
output:
17
result:
ok "17"
Test #8:
score: 0
Accepted
time: 0ms
memory: 3156kb
input:
11 1 krokodkroko
output:
54
result:
ok "54"
Test #9:
score: 0
Accepted
time: 0ms
memory: 3396kb
input:
87 1 kkkokokokokdokdokodkodkdokdokdokdodkodkokokdodkorkrrrrrrrrrrrrrrrrrrrrdkokokokdrokrodkk
output:
2099
result:
ok "2099"
Subtask #3:
score: 7
Accepted
Test #10:
score: 7
Accepted
time: 0ms
memory: 3168kb
input:
5 3 dodor
output:
30
result:
ok "30"
Test #11:
score: 0
Accepted
time: 0ms
memory: 3332kb
input:
3 3 kro
output:
18
result:
ok "18"
Test #12:
score: 0
Accepted
time: 1ms
memory: 3396kb
input:
2 4 rd
output:
26
result:
ok "26"
Test #13:
score: 0
Accepted
time: 0ms
memory: 3292kb
input:
100 10 krokokdokorkokodkokrokokdorkokokdkdkkdkdrrrrddrkdokodkrokdorkdokdrokrdordkordkdrokdrokdrokdro...
output:
3415
result:
ok "3415"