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 1003. Parity

1003-Classical problem?
Posted by svr 12 Jun 2007 14:24
Got Ac by using serious algorithm of building spanning forest in bipartite graph of segment’s ends only.
All simple “sport’s” attempts are failed because of TLE.
Fist mistake in answers  found when meet chord [a,b] in some tree of the forest but dist[a]+dist[b]+ves([a,b]) is odd;
 Dist[]- Boolean function of distances from roots of trees to their nodes.
Basic operation- link of two trees when new arc [a,b] connects to different trees.
For each node v tree[v]- tree, containing v- helpful array.
For linking trees used vector<int>Smeg[5000]- as dynamic structure of the Graph.
And BFS when second tree linking to the first one.
Such difficult problem must be described somewhere except for timus or why >1000 authors had solved it.
P.S. Bad data y>len, x>y doesn’t presence in test1(I verified it).

Edited by author 12.06.2007 14:25
Re: 1003-Classical problem?
Posted by MikleB 6 Feb 2008 05:27
Я делал намного проще)) просто dfs на наличие циклов нечетной длины
Re: 1003-Classical problem?
Posted by svr 6 Feb 2008 22:03
Write your algo in psevdocod and I will mine!
It is most helpfull to find core of the problem.