42082023-03-16 14:13:24gittyGyros (30)cpp17Wrong answer 9/304ms3592 KiB
#include <bits/stdc++.h>

using namespace std;

int main()
{
    //ifstream cin("in.txt");
    /// variables:
    int t, r, b, cs;
    cin>>t;
    int eredmeny;
    char x;
    bool v = 0;
    int dbB, dbCs, dbV;
    /// solution :
    for(int i = 0; i < t; i++)
    {
        /// file-in
        cin>>r>>b>>cs;
        dbB=0;
        dbCs=0;
        dbV = 0;
        eredmeny = 0;
        v = 0;
        /// counting:
        for(int i = 0; i < r; i++)
        {
            cin>>x;
            if(x=='B') dbB++;
            if(x=='C') dbCs++;
            if(x=='V')
            {
              if(!v)
              {
                  v=1;
                  dbV++;
              }
              else
              {
                  v=0;
                  dbCs++;
                  dbB++;
                  dbV++;
              }
            }
        }
        /// cases:
        if(cs%2 && b%2 && dbV>0)
        {
            eredmeny++;
            cs--;
            b--;
        }
        while(dbCs && cs)
        {
            cs-=2;
            dbCs--;
            eredmeny++;
        }
        while(dbB && b)
        {
            b-=2;
            dbB--;
            eredmeny++;
        }
        cout<<eredmeny<<endl;
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base9/30
1Accepted0/03ms1748 KiB
2Wrong answer0/04ms1908 KiB
3Wrong answer0/23ms2156 KiB
4Wrong answer0/23ms2204 KiB
5Accepted2/23ms2340 KiB
6Wrong answer0/33ms2544 KiB
7Wrong answer0/33ms2632 KiB
8Wrong answer0/33ms2756 KiB
9Accepted2/23ms2876 KiB
10Wrong answer0/23ms2972 KiB
11Accepted2/23ms3184 KiB
12Accepted3/33ms3396 KiB
13Wrong answer0/34ms3480 KiB
14Wrong answer0/34ms3592 KiB