60672023-10-29 15:34:24horvathabelGyros (30)cpp17Wrong answer 10/303ms4324 KiB
#include <bits/stdc++.h>
using namespace std;

int main()
{
    int t;
    cin>>t;
    for (int z=0;z<t;z++){
        int n,a,b;
        cin>>n>>a>>b;
        string r;
        cin>>r;
        int c=0;
        int v=0;
        int m=0;
        for (char x: r){
            if (x=='C') c++;
            if (x=='B') m++;
            if (x=='V') v++;
        }
        int ans=0;
        if(c*2<=a){
            a-=c*2;
            ans+=c;
        }
        if (m*2<=b){
            b-=m*2;
            ans+=m;
        }
        ans+=min(v,min(b,a));
        cout<<ans<<endl;
    }
}
SubtaskSumTestVerdictTimeMemory
base10/30
1Accepted0/03ms1816 KiB
2Wrong answer0/03ms2208 KiB
3Wrong answer0/23ms2420 KiB
4Accepted2/23ms2740 KiB
5Accepted2/23ms2952 KiB
6Wrong answer0/33ms2800 KiB
7Wrong answer0/33ms3080 KiB
8Wrong answer0/33ms3276 KiB
9Accepted2/22ms3364 KiB
10Accepted2/23ms3388 KiB
11Accepted2/23ms3584 KiB
12Wrong answer0/33ms3808 KiB
13Wrong answer0/33ms4076 KiB
14Wrong answer0/33ms4324 KiB