#abc290b. B - Qual B
B - Qual B
Score : points
问题描述
在一场编程竞赛的资格赛中,共有 名参赛者。所有参赛者的排名各不相同。
您将得到一个长度为 的字符串 ,表示参赛者是否愿意参加决赛。具体规则如下:
- 如果字符串 的第 个字符是
o
,则资格赛排名第 的参赛者希望参加决赛; - 如果字符串 的第 个字符是
x
,则资格赛排名第 的参赛者不愿参加决赛。
在所有希望参加决赛的选手中,排名最小的 位选手将晋级决赛。
请输出一个长度为 的字符串 ,满足以下条件:
- 如果资格赛排名第 的选手晋级决赛,则字符串 的第 个字符为
o
; - 如果资格赛排名第 的选手未能晋级决赛,则字符串 的第 个字符为
x
。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
There were contestants in the qualification round of a programming contest. All contestants got distinct ranks.
You are given a length- string , which represents whether the contestants want to participate in the final round or not. Specifically,
- if the -th character of is
o
, the contestant ranked -th in the qualification wants to participate in the final; - if the -th character of is
x
, the contestant ranked -th in the qualification does not want to participate in the final.
Among those who want to participate in the final, contestants with the smallest ranks advance to the final.
Print a string of length that satisfies the following conditions:
- if the contestant ranked -th in the qualification advances to the final, the -th character of is
o
; - if the contestant ranked -th in the qualification does not advance to the final, the -th character of is
x
.
Constraints
- and are integers.
- is a string of length consisting of
o
andx
. - has at least
o
's.
Input
The input is given from Standard Input in the following format:
Output
Print the answer.
Sample Input 1
10 3
oxxoxooxox
Sample Output 1
oxxoxoxxxx
In this input, people took part in the qualification round, and of them advance to the final.
- The participant who ranked -st in the qualification wants to participate in the final, so the participant advances to the final. participant has advanced so far.
- The participants who ranked -nd and -rd in the qualification do not want to participate in the final, so the participants do not advance to the final.
- The participant who ranked -th in the qualification wants to participate in the final, so the participant advances to the final. participants have advanced so far.
- The participants who ranked -th in the qualification does not want to participate in the final, so the participant does not advance to the final.
- The participant who ranked -th in the qualification wants to participate in the final, so the participant advances to the final. participants have advanced so far.
- Now that people have advanced to the final, no participants ranked -th or lower advance to the final.
update @ 2024/3/10 12:06:32