Created
March 24, 2020 07:18
-
-
Save andriiburka/559fdae60c052004b6292a3fb190fa7f to your computer and use it in GitHub Desktop.
01_Concert 90/100
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
_____/\\\\\\\\\____________________________/\\\___________________________________________ | |
___/\\\\\\\\\\\\\_________________________\/\\\__________________________________________ | |
__/\\\/////////\\\________________________\/\\\___________________/\\\___/\\\___________ | |
_\/\\\_______\/\\\___/\\/\\\\\\___________\/\\\____/\\/\\\\\\\___\///___\///___________ | |
_____\/\\\\\\\\\\\\\\\__\/\\\////\\\_____/\\\\\\\\\___\/\\\/////\\\___/\\\___/\\\_________ | |
_\/\\\/////////\\\__\/\\\__\//\\\___/\\\////\\\___\/\\\___\///___\/\\\__\/\\\________ | |
___\/\\\_______\/\\\__\/\\\___\/\\\__\/\\\__\/\\\___\/\\\__________\/\\\__\/\\\_______ | |
_\/\\\_______\/\\\__\/\\\___\/\\\__\//\\\\\\\/\\__\/\\\__________\/\\\__\/\\\______ | |
_________\///________\///___\///____\///____\///////\//___\///___________\///___\///______ | |
''' | |
import re | |
concert_dict = {} | |
bands_time = {} | |
popular_band_stars = '' | |
while True: | |
command = re.split("; ", input()) | |
if "start of concert" in command: | |
popular_band_stars = input() | |
break | |
elif "Add" in command: | |
cmd_add = command[0] | |
band_add = command[1] | |
stars_add = re.split(", ", command[2]) | |
if band_add not in concert_dict: | |
concert_dict[band_add] = stars_add | |
else: | |
[concert_dict[band_add].append(name) for name in stars_add if name not in concert_dict[band_add]] | |
elif "Play" in command: | |
cmd_play = command[0] | |
band_play = command[1] | |
time_play = int(command[2]) | |
if band_play not in bands_time: | |
bands_time[band_play] = time_play | |
else: | |
bands_time[band_play] += time_play | |
print(f"Total time: {sum([time for band, time in bands_time.items()])}") | |
[print(f"{band} -> {time}") for band, time in sorted(bands_time.items(), key=lambda item: -item[1])] | |
if popular_band_stars in concert_dict: | |
print(popular_band_stars) | |
[print(f"=> {star}") for star in concert_dict[popular_band_stars]] | |
# _/\\\\\\\\\\\\\________________________________________________________________ | |
# _\/\\\/////////\\\_________________________________/\\\_________________________ | |
# __\/\\\_______\/\\\________________________________\/\\\_________________________ | |
# ___\/\\\\\\\\\\\\\\____/\\\____/\\\___/\\/\\\\\\\___\/\\\\\\\\______/\\\\\\\\\____ | |
# ____\/\\\/////////\\\__\/\\\___\/\\\__\/\\\/////\\\__\/\\\////\\\___\////////\\\___ | |
# _____\/\\\_______\/\\\__\/\\\___\/\\\__\/\\\___\///___\/\\\\\\\\/______/\\\\\\\\\\__ | |
# ______\/\\\_______\/\\\__\/\\\___\/\\\__\/\\\__________\/\\\///\\\_____/\\\/////\\\__ | |
# _______\/\\\\\\\\\\\\\/___\//\\\\\\\\\___\/\\\__________\/\\\_\///\\\__\//\\\\\\\\/\\_ | |
# ________\/////////////______\/////////____\///___________\///____\///____\////////\//__ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment