ENG  RUSTimus Online Judge
Online Judge
Problems
Authors
Online contests
About Online Judge
Frequently asked questions
Site news
Webboard
Links
Problem set
Submit solution
Judge status
Guide
Register
Update your info
Authors ranklist
Current contest
Scheduled contests
Past contests
Rules
back to board

Discussion of Problem 1208. Legendary Teams Contest

How I solved it! :D
Posted by GastonFontenla 20 Aug 2015 13:31
Hi! After 3 algorithms, I finally nailed it!. Don't try coloring, doesn't work. What I did:

First, convert the teams onto nodes, and create ONE bidirectional edge between two teams when these team are sharing one or two contestants. Then, I make a pair array, and save, in decreasing order, the grades of the nodes ant their "names" (I used  numbers). When I have that ordered array, I delete the nodes when have more than zero adjacent nodes. If have zero adjacent, means that the team is non-sharing any contestant. When you deleted a node, don't need to reorder the grades array. Finally, return the total initial nodes minus the times that I had deleted teams. Hope it helps you. Bye!