Loading...

Във форума е въведено ограничение, което позволява на потребителите единствено да разглеждат публикуваните въпроси.

Violeta123 avatar Violeta123 2 Точки

Dictionaries - More Exercises, MOBA Challenger - 90/100

Здравейте, колеги!

Ако може някой да ми открие пропускав този решение, ще съм много благодарна - https://pastebin.com/K0Sv4iFm

Условие:

Pesho is a pro MOBA player, he is struggling to become а master of the Challenger tier. So he watches carefully the statistics in the tier.

You will receive several input lines in one of the following formats:

"{player} -> {position} -> {skill}"

"{player} vs {player}"

The player and position are strings, the given skill will be an integer number. You need to keep track of every player. 

When you receive a player and his position and skill, add him to the player pool, if he isn`t present, else add his position and skill or update his skill, only if the current position skill is lower than the new value.

If you receive "{player} vs {player}" and both players exist in the tier, they duel with the following rules:

Compare their positions, if they got at least one in common, the player with better total skill points wins and the other is demoted from the tier -> remove him. If they have same total skill points, the duel is tie and they both continue in the Season.

If they don`t have positions in common, the duel isn`t happening and both continue in the Season.

You should end your program when you receive the command "Season end". At that point you should print the players, ordered by total skill in desecending order, then ordered by player name in ascending order. Foreach player print their position and skill, ordered desecending by skill, then ordered by position name in ascending order.

Input / Constraints

  • The input comes in the form of commands in one of the formats specified above.

  • Player and position will always be one word string, containing no whitespaces.

  • Skill will be an integer in the range [0, 1000].

  • There will be no invalid input lines.

  • The programm ends when you receive the command "Season end".

Output

  • The output format for each player is:

"{player}: {totalSkill} skill"

"- {position} <::> {skill}"

Examples

Input

Output

Comments

Pesho -> Adc -> 400

Gosho -> Jungle -> 300

Stamat -> Mid -> 200

Stamat -> Support -> 250

Season end

Stamat: 450 skill

- Support <::> 250

- Mid <::> 200

Pesho: 400 skill

- Adc <::> 400

Gosho: 300 skill

- Jungle <::> 300

We order the players by total skill points descending, then by name. We print every position along its skill ordered descending by skill, then by position name.

Pesho -> Adc -> 400

Bush -> Tank -> 150

Faker -> Mid -> 200

Faker -> Support -> 250

Faker -> Tank -> 250

Pesho vs Faker

Faker vs Bush

Faker vs Hide

Season end

Faker: 700 skill

- Support <::> 250

- Tank <::> 250

- Mid <::> 200

Pesho: 400 skill

- Adc <::> 400

Faker and Pesho don`t have common position, so the duel isn`t valid.

Faker wins vs Bush /common position: "Tank". Bush is demoted.

Hide doesn`t exist so the duel isn`t valid.

We print every player left in the tier.

Тагове:
0
Fundamentals Module
niyazihasan avatar niyazihasan 83 Точки
Best Answer

Здравей,

ако добавиш break след 50 и 53 ред би трябвало  да се оправи проблема.

0
Можем ли да използваме бисквитки?
Ние използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Можете да се съгласите с всички или част от тях.
Назад
Функционални
Използваме бисквитки и подобни технологии, за да предоставим нашите услуги. Използваме „сесийни“ бисквитки, за да Ви идентифицираме временно. Те се пазят само по време на активната употреба на услугите ни. След излизане от приложението, затваряне на браузъра или мобилното устройство, данните се трият. Използваме бисквитки, за да предоставим опцията „Запомни Ме“, която Ви позволява да използвате нашите услуги без да предоставяте потребителско име и парола. Допълнително е възможно да използваме бисквитки за да съхраняваме различни малки настройки, като избор на езика, позиции на менюта и персонализирано съдържание. Използваме бисквитки и за измерване на маркетинговите ни усилия.
Рекламни
Използваме бисквитки, за да измерваме маркетинг ефективността ни, броене на посещения, както и за проследяването дали дадено електронно писмо е било отворено.