#P1786. 帮贡排序
帮贡排序
Description
At present, the guild can have at most:
- guild leader ().
- vice leaders ().
- guardians ().
- elders ().
- hall masters ().
- elites ().
- Any number of regular members ().
The above positions are listed from highest to lowest.
Now absi2011 is going to adjust almost everyone’s position in the guild. He finds this difficult, so he asks you to help.
He gives you, for each person:
- Name.
- Original position.
- Contribution.
- Level.
He wants to sort everyone in the guild except the guild leader and vice leaders by the following keys:
- Contribution (descending), primary key.
- Order of appearance in the input (from earlier to later), secondary key.
Then update these people’s positions as follows:
- Ranks to : .
- Ranks to : .
- Ranks to : .
- Ranks to : .
- Ranks to : .
However, the “Le Dou” display does not sort by contribution, but by position and level.
After updating positions, output the final list as “Le Dou” would display it, sorted by:
- Position (descending), primary key.
- Level (descending), secondary key.
- Order of appearance in the input (from earlier to later), tertiary key.
Note: absi2011 has no authority to adjust the positions of the guild leader or the vice leaders, including his own.
Input Format
The first line contains a positive integer , the number of members in Xingyue Homeland.
Each of the next lines contains two strings and two integers: name, position, contribution, and level.
Output Format
Output lines. Each line contains the name, position, and level in the order “Le Dou” displays after the adjustments.
9
DrangonflyKang BangZhu 100000 66
RenZaiJiangHu FuBangZhu 80000 60
absi2011 FuBangZhu 90000 60
BingQiLingDeYanLei HuFa 89000 58
Lcey HuFa 30000 49
BangYou3 ZhangLao 1000 1
BangYou1 TangZhu 100 40
BangYou2 JingYing 40000 10
BangYou4 BangZhong 400 1
DrangonflyKang BangZhu 66
RenZaiJiangHu FuBangZhu 60
absi2011 FuBangZhu 60
BingQiLingDeYanLei HuFa 58
BangYou2 HuFa 10
Lcey ZhangLao 49
BangYou1 ZhangLao 40
BangYou3 ZhangLao 1
BangYou4 ZhangLao 1
Hint
For of the testdata, .
For of the testdata, all contributions are .
For of the testdata, it is guaranteed that:
- .
- name length .
- All names are pairwise distinct.
- Names contain only visible ASCII characters.
- contribution of each person .
- level of each person .
- The position is always one of the following seven:
- .
- .
- .
- .
- .
- .
- .
- Initially, the guild has at most:
- guild leader.
- vice leaders.
- guardians.
- elders.
- hall masters.
- elites.
- There is exactly one guild leader.
- There are exactly two vice leaders.
- Exactly one of the vice leaders is named absi2011.
Translated by ChatGPT 5
京公网安备 11011102002149号