|
|||
VotingSince we were not able to prevent the cyber attack, and the bots were able to access our data, the attackers decided that they want to "get physical" and perform a full-scale military attack against us to try and kidnap the best player in each team. However the AI bots were not able to find these kind of information among the stolen logs, so they entrust you to create an algorithm which is able to decide the best player in your team by the following voting algorithm:
InputThe input consists of two units (each line is terminated with an end of line character):
OutputThe output is a string, which is the name of the last element after performing the above algorithm (so the "name of the best group member"). If there is a tie at the end, then list each elements in alphabetically descending order, each separated by a single space character. Example
Input:
Explanation
LIST:
John Bob Alice Lucy
Lucy Bob John Alice
Alice John Bob Lucy
Alice: 1+0+3 = 4
Bob: 2+2+1 = 5
John: 3+1+2 = 6
Lucy: 0+3+0 = 3
AVG: (4+5+6+3)/4 = 4.5
DEL: Alice, Lucy
LIST:
John Bob
Bob John
John Bob
Bob: 0+1+0 = 1
John: 1+0+1 = 2
AVG: (1+2)/2 = 1.5
DEL: Bob
LIST:
John
|
|||
University of Debrecen; Faculty of Informatics; v. 09/30/2024 |