I finally got ACC. Renat was right, I couldn't find such a stupid bug...
So I'm sorry taking your time, but I have been working on this problem since saturday contest, so I decided to ask start this topic...
Adrian Kuegel - now my program doesn't do it, and it gets ACC at least
Can anyone tell me what can be the reason for getting whole the time TLE on this problem? I am using Dijskra's algorithm, and I don't think this problem can be solved faster...
Are there some "tricks" about reading the input?