42302023-03-16 21:05:54gittyGyros (30)cpp17Wrong answer 5/304ms3652 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>>cs>>b;
        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;
                  dbV++;
              }
            }
        }
        /// cases:
        if(v) dbV--;
        if(cs%2 && b%2 && dbV>0)
        {
            eredmeny++;
            cs--;
            b--;
            dbV--;
        }
        while(dbV>0)
        {
            dbV-=2;
            dbCs++;
            dbB++;
        }
        while(dbCs && cs)
        {
            cs-=2;
            dbCs--;
            eredmeny++;
        }
        while(dbB && b)
        {
            b-=2;
            dbB--;
            eredmeny++;
        }
        cout<<eredmeny<<endl;
    }
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base5/30
1Accepted0/03ms1876 KiB
2Wrong answer0/04ms2068 KiB
3Wrong answer0/23ms2280 KiB
4Wrong answer0/23ms2492 KiB
5Accepted2/23ms2608 KiB
6Wrong answer0/33ms2800 KiB
7Wrong answer0/33ms3020 KiB
8Wrong answer0/33ms3228 KiB
9Wrong answer0/22ms3316 KiB
10Wrong answer0/22ms3340 KiB
11Wrong answer0/22ms3312 KiB
12Accepted3/33ms3312 KiB
13Wrong answer0/34ms3436 KiB
14Wrong answer0/34ms3652 KiB