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 1129. Door Painting

Idea
Posted by Felix_Mate 27 Aug 2015 15:36
My algo works O(N^3) at 0.015 sec.
Solution always exist.

Idea:
We must paint first half of edge in 'Y' and second half in 'G'.

1)Delete cycles (if the edge belongs to the cycle then we delete it from the graph) and paint edges;
2)Paint a tree.


Edited by author 27.08.2015 15:36