303870: CF746D. Green and Black Tea
Memory Limit:256 MB
Time Limit:1 S
Judge Style:Text Compare
Creator:
Submit:0
Solved:0
Description
Green and Black Tea
题意翻译
Innokentiy非常喜欢茶,今天他想喝$n$杯茶。他有$a$包绿茶和$b$包红茶。 Innokentiy不喜欢喝同一种茶(绿色或红色)连续超过$k$次。你的任务是确定喝茶的顺序(用G表示绿茶,B表示红茶。详情请参考样例)以便Innokentiy可以喝$n$杯茶,不喝同样的茶连续超过$k$次。如果你不能做到,输出“NO”。题目描述
Innokentiy likes tea very much and today he wants to drink exactly $ n $ cups of tea. He would be happy to drink more but he had exactly $ n $ tea bags, $ a $ of them are green and $ b $ are black. Innokentiy doesn't like to drink the same tea (green or black) more than $ k $ times in a row. Your task is to determine the order of brewing tea bags so that Innokentiy will be able to drink $ n $ cups of tea, without drinking the same tea more than $ k $ times in a row, or to inform that it is impossible. Each tea bag has to be used exactly once.输入输出格式
输入格式
The first line contains four integers $ n $ , $ k $ , $ a $ and $ b $ ( $ 1<=k<=n<=10^{5} $ , $ 0<=a,b<=n $ ) — the number of cups of tea Innokentiy wants to drink, the maximum number of cups of same tea he can drink in a row, the number of tea bags of green and black tea. It is guaranteed that $ a+b=n $ .
输出格式
If it is impossible to drink $ n $ cups of tea, print "NO" (without quotes). Otherwise, print the string of the length $ n $ , which consists of characters 'G' and 'B'. If some character equals 'G', then the corresponding cup of tea should be green. If some character equals 'B', then the corresponding cup of tea should be black. If there are multiple answers, print any of them.
输入输出样例
输入样例 #1
5 1 3 2
输出样例 #1
GBGBG
输入样例 #2
7 2 2 5
输出样例 #2
BBGBGBB
输入样例 #3
4 3 4 0
输出样例 #3
NO