Simulate a server of a role-playing game for two players. Each player has an “elo”, which is a value larger the better is the player. Everyone starts with 1200 points, and nobody ever gets a lower quantity, no matter how many games are lost. Whenever there is a match, the winner gets 10 elo points, and the loser loses 10 elo points (with the limitation above). The elo of a player is kept when he or she disconnects from the server.
We have these instructions:
Input
Input consists of several instructions for at most 105 players. Each player’s name is different and made up of only lowercase letters.
Output
For every instruction “GET_ELO” (and perhaps “PLAY”) print the proper output. At the end, print an empty line, the word “RANKING”, and a ranking sorted in decreasing order by elo (if there is a tie, print first the alfabetically smallest name) with all the players ever connected to the server.
Input
LOGIN destello LOGIN fxtr PLAY destello fxtr PLAY destello fxtr LOGIN carokhan GET_ELO destello GET_ELO fxtr LOGOUT destello PLAY carokhan fxtr LOGOUT fxtr LOGIN cerebrus LOGOUT cerebrus LOGIN grassman PLAY destello grassman PLAY grassman destello LOGIN cusell
Output
destello 1220 fxtr 1200 player(s) not connected player(s) not connected RANKING destello 1220 carokhan 1210 cerebrus 1200 cusell 1200 fxtr 1200 grassman 1200
Input
PLAY omer petit LOGIN omer PLAY omer petit LOGIN omer LOGOUT omer GET_ELO omer
Output
player(s) not connected player(s) not connected omer 1200 RANKING omer 1200