#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
char x[];
char xx[];
int main() {
int t;
cin>>t;
while(t--) {
int a,b,c,n;
cin>>n>>a>>b>>c;
for(int i=; i<n; i++) xx[i]=;
scanf("%s",x);
int r=,p=,s=;
for(int i=; i<n; i++) {
if(x[i]=='R') r++;
else if(x[i]=='P') p++;
else s++;
}
int ans=;
ans+=min(r,b);
ans+=min(p,c);
ans+=min(s,a);
if(ans>=(n+)/) {
printf("YES\n");
for(int i=; i<n; i++) {
if(x[i]=='R'&&b>) {
xx[i]='P';
b--;
} else if(x[i]=='P'&&c>) {
xx[i]='S';
c--;
} else if(x[i]=='S'&&a>) {
a--;
xx[i]='R';
}
}
for(int i=; i<n; i++) {
if(xx[i]==) {
if(a>) {
printf("R");
a--;
} else if(b>) {
printf("P");
b--;
} else if(c>) {
c--;
printf("S");
}
} else printf("%c",xx[i]);
}
printf("\n");
} else {
printf("NO\n");
}
}
return ;
}

codeforces Codeforces Round #597 (Div. 2) B. Restricted RPS 暴力模拟的更多相关文章

  1. Codeforces Round #597 (Div. 2) B. Restricted RPS

    链接: https://codeforces.com/contest/1245/problem/B 题意: Let n be a positive integer. Let a,b,c be nonn ...

  2. Codeforces Round #164 (Div. 2) A. Games【暴力/模拟/每个球队分主场和客场,所有球队两两之间进行一场比赛,要求双方球服颜色不能相同】

    A. Games time limit per test 1 second memory limit per test 256 megabytes input standard input outpu ...

  3. Codeforces Beta Round #80 (Div. 2 Only)【ABCD】

    Codeforces Beta Round #80 (Div. 2 Only) A Blackjack1 题意 一共52张扑克,A代表1或者11,2-10表示自己的数字,其他都表示10 现在你已经有一 ...

  4. Codeforces Beta Round #83 (Div. 1 Only)题解【ABCD】

    Codeforces Beta Round #83 (Div. 1 Only) A. Dorm Water Supply 题意 给你一个n点m边的图,保证每个点的入度和出度最多为1 如果这个点入度为0 ...

  5. Codeforces Beta Round #79 (Div. 2 Only)

    Codeforces Beta Round #79 (Div. 2 Only) http://codeforces.com/contest/102 A #include<bits/stdc++. ...

  6. Codeforces Beta Round #77 (Div. 2 Only)

    Codeforces Beta Round #77 (Div. 2 Only) http://codeforces.com/contest/96 A #include<bits/stdc++.h ...

  7. Codeforces Beta Round #76 (Div. 2 Only)

    Codeforces Beta Round #76 (Div. 2 Only) http://codeforces.com/contest/94 A #include<bits/stdc++.h ...

  8. Codeforces Beta Round #75 (Div. 2 Only)

    Codeforces Beta Round #75 (Div. 2 Only) http://codeforces.com/contest/92 A #include<iostream> ...

  9. Codeforces Beta Round #74 (Div. 2 Only)

    Codeforces Beta Round #74 (Div. 2 Only) http://codeforces.com/contest/90 A #include<iostream> ...

随机推荐

  1. TCP 协议快被淘汰了,UDP 协议才是新世代的未来?

    TCP 协议可以说是今天互联网的基石,作为可靠的传输协议,在今天几乎所有的数据都会通过 TCP 协议传输,然而 TCP 在设计之初没有考虑到现今复杂的网络环境,当你在地铁上或者火车上被断断续续的网络折 ...

  2. 【33】卷积步长讲解(Strided convolutions)

    卷积步长(Strided convolutions) 卷积中的步幅是另一个构建卷积神经网络的基本操作,让我向你展示一个例子. 如果你想用3×3的过滤器卷积这个7×7的图像,和之前不同的是,我们把步幅设 ...

  3. Hyperparameter tuning

    超参数调整 详细可以参考官方文档 定义 在拟合模型之前需要定义好的参数 适用 Linear regression: Choosing parameters Ridge/lasso regression ...

  4. 关于Java8中的Comparator那些事

    在前面一篇博文中,对于java中的排序方法进行比较和具体剖析,主要是针对 Comparator接口和 Comparable接口,无论是哪种方式,都需要实现这个接口,并且重写里面的 方法.Java8中对 ...

  5. P1339 热浪【最短路】

    #include <bits/stdc++.h> #define dbg(x) cout << #x << "=" << x < ...

  6. 1级搭建类110-Oracle 18c SI FS(Windows Server 2019)公开

    Oracle 18c 单实例文件系统在Windows Server 2019上的安装 在线查看

  7. 二叉堆(3)SkewHeap

    斜堆. 测试文件 main.cpp: #include <iostream> #include "SkewHeap.h" using std::cout; using ...

  8. git 命令 总结

    1.添加所有文件 git add . 2.添加某个文件 git add filename 3.commit 注释 git commit -m'commit 注释' 4.修改commit 注释 git ...

  9. overfitting &&underfitting

    1.过拟合 然能完美的拟合模型,但是拟合出来的模型会含有大量的参数,将会是一个含有大量参数的非常庞大的模型,因此不利于实现 1.1解决过拟合的方法 1.1.1 特征选择,通过选取特征变量来减少模型参数 ...

  10. 文件包含漏洞(DVWA环境中复现)

    LOW: 源代码: <?php // The page we wish to display $file = $_GET[ 'page' ]; ?> 可以看到,low级别的代码对包含的文件 ...