Problem Statement

A programming contest called World Tour Finals is currently taking place with N players, and half of the competition time has passed. In this contest, M problems are provided, and the score A_i of problem i is a multiple of 100 between 500 and 2500.

For each i = 1, ..., N, a string S_i is given to represent which problems player i has already solved. S_i is a string of length M consisting of 'o' and 'x', where the j-th character of S_i is 'o' if player i has already solved problem j, and 'x' otherwise. However, no player has solved all the problems yet.

The total score of player i is calculated by adding up the scores of the solved problems and adding a bonus of i points.
Now, answer the following question for each i = 1, ..., N.

  • By solving at least how many unsolved problems, can the total score of player i exceed the current total scores of all other players?

Note that, from the conditions and constraints in the problem statement, it can be proven that player i can exceed the current total scores of all other players by solving all the problems. Please keep in mind that the answer is always defined.

Constraints

  • 2 ≤ N ≤ 100
  • 1 ≤ M ≤ 100
  • 500 ≤ A_i ≤ 2500
  • A_i is a multiple of 100
  • S_i is a string of length M consisting of 'o' and 'x'
  • S_i contains at least one 'x'
  • All input values are integers

Input

The input is given in the following format from the standard input.

N M/nA_1 A_2 /ldots A_M/nS_1/nS_2/n/vdots/nS_N

Output

Output N lines. Output the answer to the question regarding player i on the i-th line.

World Tour Finals: Programming Contest Score Calculation

原文地址: https://www.cveoy.top/t/topic/o9uk 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录