18202022-12-04 09:17:21sztomiGyros (30)cpp17Wrong answer 15/303ms3456 KiB
#include <bits/stdc++.h>

using namespace std;

void solve(){
    int n, c, b;
    cin >> n >> c >> b;
    int c_db, b_db, v_db;
    c_db = b_db = v_db = 0;
    char t;
    for(int i = 0; i < n; i++){
        cin >> t;
        switch(t){
        case 'C':
            c_db++;
            break;
        case 'B':
            b_db++;
            break;
        case 'V':
            v_db++;
            break;
        }
    }

    int c_csinal = min(c_db, c/2);
    c -= c_csinal*2;
    int b_csinal = min(b_db, b/2);
    b -= b_csinal*2;
    int v_csinal = min(v_db, min(b, c));
    cout << c_csinal + b_csinal + v_csinal << "\n";
}

int main()
{
    ios::sync_with_stdio(false);
    cin.tie(NULL);

    int t;
    cin >> t;
    while(t--){
        solve();
    }
}
SubtaskSumTestVerdictTimeMemory
base15/30
1Accepted0/03ms1760 KiB
2Wrong answer0/03ms1936 KiB
3Accepted2/22ms2160 KiB
4Accepted2/22ms2368 KiB
5Accepted2/22ms2560 KiB
6Wrong answer0/32ms2768 KiB
7Wrong answer0/32ms2844 KiB
8Wrong answer0/32ms2968 KiB
9Accepted2/22ms3052 KiB
10Accepted2/22ms3056 KiB
11Accepted2/22ms3180 KiB
12Accepted3/32ms3252 KiB
13Wrong answer0/33ms3356 KiB
14Wrong answer0/33ms3456 KiB