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 1273. Tie

And what about this test?
Posted by Sandro 31 Jan 2005 15:42
My AC solution with DP outputs 2 in this test:
6
0 3
1 0
2 2
3 5
4 1
5 4

But the correct answer is 3. Maybe this test should be added to the test set.
My output is 3, so your DP is rather strange :) (-)
Posted by Dmitry 'Diman_YES' Kovalioff 31 Jan 2005 15:53
Re: My output is 3, so your DP is rather strange :) (-)
Posted by Sandro 31 Jan 2005 22:03
I think so :)
How did you solve it?
Posted by Vladimir Yakovlev (USU) 1 Feb 2005 20:09
Re: How did you solve it?
Posted by Sandro 3 Feb 2005 11:27
I remember the optimal answer for sets of ties with numbers k..l for all k,l (for all segments).

The optimal answer Ans(k,l+1)= max(Ans(k,l),S+1), where S is the sum of optimal answers for all segments in k..l, that any tie of any of these segments doesn't intersect (l+1)th tie. (In the first case we delete (l+1)th tie, in the second case leave (l+1) and delete all ties, intersecting it.)
    This algorith is not correct, because ties in the optimal solutions can intersect, so sum of the optimal solutions may not be solution at all. My test is the simple example of it. But this algorith gets AC, and this is very strange.