This logic is wrong. We can prove that as follows.
Consider the following arrangement
v1 ... c1.start ... c2.start ... c2.end ... w2 ... c1.end ... w1
According to your algo, we will chose c1 as the contest (which uses wormholes v1 and w1), whereas chosing c2 would be better (we can use wormholes v1 and w2).
Keshav, do you have some way of preventing such errors? This seems to be pretty common. Also, it is quite difficult to reason out if a greedy algo is wrong like above.