# |
Author |
Problem |
Lang |
Verdict |
Time |
Memory |
Sent |
Judged |
|
261509699 |
Practice:
PuJunXi |
1245B
- 37
|
C++20 (GCC 13-64)
|
Accepted
|
46 ms
|
16 KB
|
2024-05-18 12:59:14 |
2024-05-18 12:59:14 |
|
/*
/////// // // //
// // // // // //
/////// // // // // // ////// ///
// // // // // // // // // /// //
// // // // // // // // // // // //
// /////// /////// /////// // /// // // //
*/
#include<bits/stdc++.h>
#define ll long long
#define ull unsigned long long
#define YES cout<<"Yes"<<endl
#define NO cout<<"No"<<endl
#define fr1(a,b,c) for(int i=a;i<=b;i+=c)
#define fr2(a,b,c) for(int j=a;j<=b;j+=c)
#define fr3(a,b,c) for(int i=a;i>=b;i-=c)
#define fr4(a,b,c) for(int j=a;j>=n;j-=c)
#define fr5(a,b,c) for(a;b;c)
#define wh(a) while(a)
#define ioyh ios::sync_with_stdio(0)
#define bk break
#define con continue
#define uns using namespace std
#define rt return
uns;
int t,n,a,b,c;
string s;
signed main(){
ioyh;
cin>>t;
wh(t--){
cin>>n>>a>>b>>c>>s;
int x=0,y=0,z=0;
fr1(0,n-1,1){
if(s[i]=='S') x++;
else if(s[i]=='R') y++;
else z++;
}
if(2*(min(a,x)+min(b,y)+min(c,z))<n){NO;con;}
YES;
string t;
fr1(0,n-1,1){
if(s[i]=='R'&&b){
t.push_back('P');
b--;
}
else if(s[i]=='P'&&c){
t.push_back('S');
c--;
}
else if(s[i]=='S'&&a){
t.push_back('R');
a--;
}
else t.push_back('#');
}
fr1(0,n-1,1){
if(t[i]=='#'){
if(a) t[i]='R',a--;
else if(b) t[i]='P',b--;
else if(c) t[i]='S',c--;
}
}
cout<<t<<endl;
}
rt 0;
}
Click to see test details