Probl. Snowwhite, exam prep.05.01.2018
Здравейте, моля за малко помощ. Не мога да разбера къде греша, дали при сортирането на изхода или в презаписванията на Dict<string, Dict<string, int>. Подозирам, че в сортирането нещо ми липсва. Примерните резултати са верни, но Judge ми дава 70/100.
Решението - https://pastebin.com/V7wB7zRm.
Условие:"
You will be receiving several input lines which contain data about dwarfs in the following format:
{dwarfName} <:> {dwarfHatColor} <:> {dwarfPhysics}
The dwarfName and the dwarfHatColor are strings. The dwarfPhysics is an integer.
You must store the dwarfs in your program. There are several rules though:
- If 2 dwarfs have the same name but different color, they should be considered different dwarfs, and you should store both of them.
- If 2 dwarfs have the same name and the same color, store the one with the higher physics.
When you receive the command “Once upon a time”, the input ends. You must order the dwarfs by physics in descending order and then by total count of dwarfs with the same hat color in descending order.
Then you must print them all."
Input |
Output |
Pesho <:> Red <:> 2000 Tosho <:> Blue <:> 1000 Gosho <:> Green <:> 1000 Sasho <:> Yellow <:> 4500 Prakasho <:> Stamat <:> 1000 Once upon a time |
(Yellow) Sasho <-> 4500 (Red) Pesho <-> 2000 (Blue) Tosho <-> 1000 (Green) Gosho <-> 1000 (Stamat) Prakasho <-> 1000 |
Pesho <:> Red <:> 5000 Pesho <:> Blue <:> 10000 Pesho <:> Red <:> 10000 Gosho <:> Blue <:> 10000 Once upon a time |
(Blue) Pesho <-> 10000 (Blue) Gosho <-> 10000 (Red) Pesho <-> 10000
|