General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
130572524 Practice:
Acc_Robin
1070J - 29 C++17 (GCC 9-64) Accepted 78 ms 4820 KB 2021-10-02 17:35:32 2021-10-02 17:35:33
→ Source
#include<bits/stdc++.h>
using namespace std;
namespace Acc{
 int ct[26],f[30009];
 string s;
 long long z;
 void work(){
  int n,m,c,d,i,j,l;
  cin>>n>>m>>l>>s,d=l-n-m,memset(ct,0,104);
  for(char c:s)++ct[c-65];
  for(*f=1,z=1e18,c=0;c<26;++c){
   for(i=1;i<=n;++i)f[i]=0;
   for(i=0;i<26;++i)if(i!=c)for(j=n;j>=ct[i];--j)f[j]|=f[j-ct[i]];
   for(i=min(n,ct[c]);~i;--i)if(f[n-i])z=min(z,1ll*i*max(0,ct[c]-i-d));
  }cout<<z<<'\n';
 }
}
int main(){
 ios::sync_with_stdio(0),cin.tie(0);
 int T;for(cin>>T;T--;)Acc::work();
}
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details