#abc323c. C - World Tour Finals
C - World Tour Finals
Score : points
问题描述
正在进行一场编程比赛——世界巡回赛总决赛,有 名选手参赛,目前比赛时间已经过半。本场竞赛共有 道题目,第 题的分数 是在 到 (包含)之间、能被 整除的数。
对于每个 ,我们给出一个字符串 ,表示选手 已经解决的题目。 是长度为 的由 o
和 x
组成的字符串,其中 的第 个字符如果是 o
,表示选手 已经解决第 题;如果是 x
,则表示他们还未解决这道题。注意,在当前情况下,没有选手已经解决了所有的问题。
选手 的总得分计算为其已解决题目得分之和,再加上 奖励分数 分。
对于每个 ,请回答以下问题:
- 至少需要选手 解决多少道尚未解决的问题才能使其总分超过其他所有选手当前的总分?
请注意,在本题描述的条件及限制下,可以证明选手 通过解决所有剩余问题一定能超过其他所有选手当前的总分,因此答案总是存在的。
以上为通义千问 qwen-max 翻译,仅供参考。
Problem Statement
The programming contest World Tour Finals is underway, where players are participating, and half of the competition time has passed. There are problems in this contest, and the score of problem is a multiple of between and , inclusive.
For each , you are given a string that indicates which problems player has already solved. is a string of length consisting of o
and x
, where the -th character of is o
if player has already solved problem , and x
if they have not yet solved it. Here, none of the players have solved all the problems yet.
The total score of player is calculated as the sum of the scores of the problems they have solved, plus a bonus score of points.
For each , answer the following question.
- At least how many of the problems that player has not yet solved must player solve to exceed all other players' current total scores?
Note that under the conditions in this statement and the constraints, it can be proved that player can exceed all other players' current total scores by solving all the problems, so the answer is always defined.
Constraints
- is a multiple of .
- is a string of length consisting of
o
andx
. - contains at least one
x
. - All numeric values in the input are integers.
Input
The input is given from Standard Input in the following format:
Output
Print lines. The -th line should contain the answer to the question for player .
Sample Input 1
3 4
1000 500 700 2000
xxxo
ooxx
oxox
Sample Output 1
0
1
1
The players' total scores at the halfway point of the competition time are points for player , points for player , and points for player .
Player is already ahead of all other players' total scores without solving any more problems.
Player can, for example, solve problem to have a total score of points, which would exceed all other players' total scores.
Player can also, for example, solve problem to have a total score of points, which would exceed all other players' total scores.
Sample Input 2
5 5
1000 1500 2000 2000 2500
xxxxx
oxxxx
xxxxx
oxxxx
oxxxx
Sample Output 2
1
1
1
1
0
Sample Input 3
7 8
500 500 500 500 500 500 500 500
xxxxxxxx
oxxxxxxx
ooxxxxxx
oooxxxxx
ooooxxxx
oooooxxx
ooooooxx
Sample Output 3
7
6
5
4
3
2
0
update @ 2024/3/10 01:44:25