P27658 [洛谷] [COCI 2023/2024 #3] Eurokod
普及
题目描述

Problem Description

Eurokod, the global competition for beautiful and highly readable code, is being held for the first time this year!

A total of $n$ participants took part in the competition, numbered sequentially from $1$ to $n$. Each participant has written a piece of code.

Their codes will be evaluated by a group of computer scientists. This group consists of a leader and other members. The leader will score the codes using one method, while the other members will use another method.

Leader's Scoring:

The leader ranks the codes based on their perceived beauty in descending order. The most beautiful code receives $n$ points, with each subsequent code receiving one point less.

Other Members' Scoring:

Each other member will vote for the code they consider the most beautiful. After all votes are cast, the codes are ranked by the number of votes received in descending order. The code with the most votes receives $n$ points, with each subsequent code receiving one point less.

Total Score:

The total score of a code is the sum of the leader's score and the other members' score.

Your task is to output the codes' numbers in descending order of their total scores. If two codes have the same total score, the one with a higher score from the other members is listed first.

Input Format

The first line contains an integer $n$ ($1 \le n \le 50$), representing the number of participants.

The second line contains $n$ integers $a_i$ ($1 \le a_i \le n$), where the $i$-th integer represents the number of the code that the leader ranks as the $i$-th most beautiful. The integers are given in descending order of beauty. It is guaranteed that each number from $1$ to $n$ appears exactly once.

The third line contains $n$ integers $b_i$ ($0 \le b_i \le 200$), where the $i$-th integer represents the number of votes received by the $i$-th code from the other members. It is guaranteed that no two codes receive the same number of votes.

Output Format

Output $n$ lines, listing the code numbers in descending order of their total scores.

Each line should be formatted as [rank]. Kod[label] ([number of points]), where [rank] is the code's ranking, [label] is the code number represented as a two-digit number with leading zeros, and [number of points] is the total score of the code.

For example, if code number $3$ wins first place with a total score of $12$, you should output 1. Kod03 (12) on the first line.

Sample Input and Output

Sample Input #1

3
1 2 3
50 10 20

Sample Output #1

1. Kod01 (6)
2. Kod03 (3)
3. Kod03 (3)

Sample Input #2

5
5 2 4 1 3
4 5 2 1 3

Sample Output #2

1. Kod02 (9)
2. Kod05 (8)
3. Kod01 (6)
4. Kod04 (4)
5. Kod03 (3)

Sample Input #3

7
6 3 2 1 5 4 7
200 56 11 0 13 105 12

Sample Output #3

1. Kod06 (13)
2. Kod01 (11)
3. Kod02 (10)
4. Kod03 (8)
5. Kod05 (7)
6. Kod07 (4)
7. Kod04 (3)

Notes/Hints

Sample Explanation 1

Kod03 and Kod02 have the same total score, but Kod03 received a higher score from the other members, so Kod03 is ranked higher.

Sample Explanation 2

The leader gives Kod05 the highest rank, so it receives $n=5$ points.

Subtasks

Subtask Points Constraints
1 17 For each code, the number of votes from other members is equal to the score from other members. Additionally, no two codes have the same total score.
2 19 No two codes have the same total score.
3 14 No special restrictions apply.
输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
3 1 2 3 50 10 20
样例输出
1. Kod01 (6) 2. Kod03 (3) 3. Kod02 (3)