#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. Hbase架构剖析

    HBase隶属于hadoop生态系统,它参考了谷歌的BigTable建模,实现的编程语言为 Java, 建立在hdfs之上,提供高可靠性.高性能.列存储.可伸缩.实时读写的数据库系统.它仅能通过主键( ...

  2. Hadoop学习之路(6)MapReduce自定义分区实现

    MapReduce自带的分区器是HashPartitioner 原理:先对map输出的key求hash值,再模上reduce task个数,根据结果,决定此输出kv对,被匹配的reduce任务取走. ...

  3. js返回时间差

    function CalcTimeSub(endTime, startTime, type) { var bool = endTime == defaultDateTime || startTime ...

  4. 安装Docker到CentOS(YUM)

    运行环境 系统版本:CentOS Linux release 7.3.1611 (Core) 软件版本:Docker 17.12.1-ce 硬件配置:无 安装过程 1.配置YUM-Docker存储库 ...

  5. git pull报错you do not have permission to pull from the repository

    you do not have permission to pull from the repository解决方法   使用git进行项目的版本管理,换了台电脑,配置了账号和邮箱后,pull一个项目 ...

  6. (备份)找回 Chrome 配置

    C:\Users\xiaogezi.cn\AppData\Local\Google\Chrome\User Data\Default\ 将 Preferences 文件复制到别的地方,用于备份: 将 ...

  7. 百度的Ueditor在VS2015/VS2010中配置需注意的地方

    1.下载:https://ueditor.baidu.com/website/download.html#uedito 官网已无1.4.3的.net版本下载,不知道百度在搞什么,下载完整版和ASP版本 ...

  8. 手把手带你开发一款 IIS 模块后门

    https://cloud.tencent.com/developer/article/1507913 首先准备工具 VS2017 IIS 开始开发 先打开 VS 创建一个 winfrom 项目然后添 ...

  9. 数据结构KMP算法中手算next数组

    总结一下今天的收获(以王道数据结构书上的为例子,虽然我没看它上面的...):其中竖着的一列值是模式串前缀和后缀最长公共前缀. 最后求得的结果符合书上的结果,如果是以-1开头的话就不需要再加1,如果是以 ...

  10. 远程执行命令_python

    一.远程执行命令模块subprocess Python可以使用subprocess下的Popen类中的封装的方法来执行命令 构造方法 popen() 创建popen类的实例化对象 ··· obj = ...