21692022-12-28 11:18:26kohumarkGyros (30)cpp11Wrong answer 15/303ms3536 KiB
#include <bits/stdc++.h>
using namespace std;

int main(){
	int n; cin >> n; int sol[n];
	for(int i=0; i<n; i++){
		int v, c, b;
		cin >> v >> c >> b;
		int vo=0; int bo=0; int co=0;
		string rend; cin >> rend;
		for(int i=0; i<v; i++){
			if(rend[i] == 'V') vo++;
			if(rend[i] == 'B') bo++;
			if(rend[i] == 'C') co++;
		}
		int kesz = 0;
		if(bo*2<b){kesz+=bo; b-=bo*2;}
		else{kesz+=b/2; b-=(b/2)*2;}
		if(co*2<c){kesz+=co; c-=co*2;}
		else{kesz+=c/2; c-=(c/2)*2;}
		if(min(b,c)<vo) kesz+=min(b,c);
		else kesz+= vo;
		sol[i]=kesz;
	}
	for(int i=0; i<n; i++) cout << sol[i] << endl;
}
SubtaskSumTestVerdictTimeMemory
base15/30
1Accepted0/03ms1808 KiB
2Wrong answer0/02ms2084 KiB
3Accepted2/22ms2292 KiB
4Accepted2/22ms2428 KiB
5Accepted2/22ms2560 KiB
6Wrong answer0/32ms2632 KiB
7Wrong answer0/32ms2780 KiB
8Wrong answer0/32ms2964 KiB
9Accepted2/22ms3036 KiB
10Accepted2/22ms3032 KiB
11Accepted2/22ms3032 KiB
12Accepted3/32ms3164 KiB
13Wrong answer0/32ms3324 KiB
14Wrong answer0/33ms3536 KiB