問題一覧 > 通常問題

No.447 Rain and Snow of Yukicoder (2)

レベル : / 実行時間制限 : 1ケース 2.000秒 / メモリ制限 : 512 MB / 標準ジャッジ問題
タグ : (AC するまで非表示) / 解いたユーザー数 163
作問者 : りあん / テスター : anta
お気に入りにしたユーザー ProblemId : 978 / 自分の提出
問題文最終更新日: 2026-06-25 22:12:33
This statement was translated by AI (claude-opus-5-5, effort medium) and may contain errors or differ in nuance from the original. The original statement takes precedence. Back to the original
yukicoder contest 154 (順位表) の他の問題:

Problem Statement

Once again, Ame is going to help Yuki, the older girl who runs "Yukicoder".

This time, the job assigned to Ame is to create the final standings of a contest.

You are given, in chronological order, input stating who got AC on which problem. Referring to the score calculation method and the output format below, output the standings.

The name of the $i$-th problem is "the $i$-th uppercase letter of the alphabet"; for example, the name of the 1st problem is "A" and the name of the 10th problem is "J".

The score calculation method on "Yukicoder" follows the actual yukicoder score calculation method:

各問題、 50×★の数+50×★の数 / (0.8+ 0.2×ACの順位)とその合計となっております。

That is, the score for each problem is given by this formula, and the total is their sum (if the above formula yields a decimal value, take the value rounded down as the score).

However, if multiple people have the same total score, they are ranked in ascending order of the time at which their score last increased (earlier is ranked higher).

In addition, the following are satisfied.

  • All submissions are AC (correct).
  • No two submissions occur at the same time.
  • The same person never gets AC on the same problem two or more times.

Input

$N$
$L_1 \ L_2 \ ... \ L_N$
$T$
$Name_1 \ P_1$
$Name_2 \ P_2$
$:$
$Name_T \ P_T$

The 1st line contains the number of problems $N$.

The 2nd line contains the level (number of ★) of each problem, $L_i \ (1 \leq i \leq N)$, separated by spaces.

The 3rd line contains the number of submissions $T$.

The following $T$ lines, starting from the 4th line, contain the information of each submission in chronological order.

Line $i \ (1 \leq i \leq T)$, counting from the 4th line, contains the submitter's name $Name_i$ and the name of the submitted problem $P_i$, separated by a space.

The input satisfies the following constraints.

  • $1 \leq N \leq 26$
  • $1 \leq L_i \leq 6$
  • $1 \leq T \leq 4000$
  • $1 \leq Length(Name_i) \leq 16, \ Name_i$ consists only of half-width lowercase English letters
  • $P_i$ is a single uppercase English letter, and is one of the letters from '$A$' to "the $N$-th letter of the alphabet"
  • If $i \neq j$, then $(Name_i, P_i) \neq (Name_j, P_j)$

Output

$1 \ Name_1 \ Score_{1,1} \ Score_{1,2} \ ... \ Score_{1,N} \ Sum_1$
$2 \ Name_2 \ Score_{2,1} \ Score_{2,2} \ ... \ Score_{2,N} \ Sum_2$
$:$
$M \ Name_M \ Score_{M,1} \ Score_{M,2} \ ... \ Score_{M,N} \ Sum_M$

Let $M$ be the number of contest participants (people who got AC on at least one problem). The output consists of $M$ lines.

On each line of the output, print the following elements separated by spaces: the rank, the name, the score for each problem, and the total score.

Print the score for each problem and the total score as integer values.

It must hold that $Sum_1 \geq Sum_2 \geq ... \geq Sum_M$, and when total scores are equal, the person whose score last increased earlier must be ranked higher.

You do not need to print a label line containing the problem names and so on.

The layout may break depending on the lengths of participants' names and the scores, but you do not need to align the layout.

Print a newline at the end.

Sample

Sample 1
Input
2
1 2
3
ame A
yuki B
yuki A
Output
1 yuki 91 200 291
2 ame 100 0 100

Yuki's score for problem A is 50 + 50 / (0.8 + 0.2 × 2) = 91.666..., which is rounded down to 91 points.

Sample 2
Input
3
2 2 4
4
ame A
yuki B
yuki A
ame B
Output
1 yuki 183 200 0 383
2 ame 200 183 0 383

The two are tied, but Yuki reached 383 points first, so Yuki is ranked higher.

Sample 3
Input
8
6 5 4 3 2 1 1 1
3
rian F
rian G
rian H
Output
1 rian 0 0 0 0 0 100 100 100 300

提出するには、Twitter 、GitHub、 Googleもしくは右上の雲マークをクリックしてアカウントを作成してください。