Help me in solving SKILLGAME problem

My issue

I am unable to understand the problem itself like what it is really asking me to do what we have to print and what is this x like how are we supposed to generate x and solutions over here seems very complex could anyone please elaborate the problem the problem is skill game the code I have written is wrong plss someone just elaborate the problem and provide a better code

My code

#include <bits/stdc++.h>
using namespace std;

int main() {
	int t;
	cin>>t;
	while(t){
	    
	    int n;
	    cin>>n;
	    
	    string g;
	    cin>>g;
	    
	    //n is len of g
	    vector<int>v;
	    for(int i=0;i<n;i++){
	        int s;
	        cin>>s;
	        v.push_back(s);
	    }
	    
	    for(int i=0;i<n;i++){
	        if(g[i]=='A'){
	            v[i]==
	        }
	    }
	    t--;
	}
}

Problem Link: Skill Game Practice Coding Problem

@anon32771341
this problem is 3000 plus rated which require immense knowledge of dsa to solve it .
Your are rated around 1000 . thus solve problem of lower rating first .
Dont jump straight to high rated porblems.

it was a part of div 4 contest I was unable to solve it there that’s why I was looking for its solution…