37792023-03-02 22:01:46SleepyOverlordGyros (30)cpp17Accepted 30/303ms3628 KiB
#include <vector>
#include <string> 
#include <set> 
#include <map> 
#include <unordered_set>
#include <unordered_map>
#include <queue> 
#include <bitset> 
#include <stack>
#include <list>

#include <numeric> 
#include <algorithm> 
#include <random>
#include <chrono>

#include <cstdio>
#include <fstream>
#include <iostream> 
#include <sstream> 
#include <iomanip>
#include <climits>

#include <cctype>
#include <cmath> 
#include <ctime>
#include <cassert>

using namespace std;

#define ULL unsigned long long
#define LL long long
#define PII pair <int, int>
#define VB vector <bool>
#define VI vector <int>
#define VLL vector <LL>
#define VD vector <double>
#define VS vector <string>
#define VPII vector <pair <int, int> >
#define VVI vector < VI >
#define VVB vector < VB >
#define SI set < int >
#define USI unordered_set <int>
#define MII map <int, int>
#define UMII unordered_map <int, int>
#define MS multiset
#define US unordered_set
#define UM unordered_map
#define UMS unordered_multiset
#define UMM unordered_multimap

#define FORN(i, n) for(int i = 0; i < (n); ++i)
#define FOR(i, a, b) for(int i = (a); i <= (b); ++i)
#define FORD(i, a, b) for(int i = (a); i >= (b); --i)

#define SZ size()
#define BG begin() 
#define EN end() 
#define CL clear()
#define X first
#define Y second
#define RS resize
#define PB push_back
#define MP make_pair
#define ALL(x) x.begin(), x.end()
#define INS insert
#define ER erase
#define CNT count

#define IN_FILE "a.in"
#define OUT_FILE "a.out"

template <typename T>
void PR(T var1)
{
	cout << var1 <<endl;
}
template <typename T, typename... Types>
void PR(T var1, Types... var2)
{
	cout << var1;
	PR(var2...);
}

int test, n, c, b;
VI cnt(255);

int main()
{
	//freopen(IN_FILE, "r", stdin);
	//freopen(OUT_FILE, "w", stdout);

	cin >> test;
	FOR(t, 1, test)
	{
		cin >> n >> c >> b;
		string s;
		cin >> s;
		fill(ALL(cnt), 0);
		FOR(i, 0, n - 1) ++cnt[s[i]];

		int b1 = min(b / 2, cnt['B']);
		int c1 = min(c / 2, cnt['C']);
		int sol1 = b1 + c1 + min(min(b - b1 * 2, c - c1 * 2), cnt['V']);

		int v2 = min(min(b, c), cnt['V']);
		int b2 = min((b - v2) / 2, cnt['B']);
		int c2 = min((c - v2) / 2, cnt['C']);
		int sol2 = v2 + b2 + c2;

		PR(max(sol1, sol2));
	}

	return 0;
}
SubtaskSumTestVerdictTimeMemory
base30/30
1Accepted0/03ms1864 KiB
2Accepted0/03ms2040 KiB
3Accepted2/23ms2232 KiB
4Accepted2/23ms2600 KiB
5Accepted2/23ms2652 KiB
6Accepted3/33ms2736 KiB
7Accepted3/33ms3040 KiB
8Accepted3/33ms3012 KiB
9Accepted2/23ms3224 KiB
10Accepted2/22ms3308 KiB
11Accepted2/22ms3304 KiB
12Accepted3/33ms3320 KiB
13Accepted3/33ms3628 KiB
14Accepted3/33ms3580 KiB