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 1987. Nested Segments

If you have WA5
Posted by SButterfly [Samara SAU] 6 Jan 2015 23:12
Try this test:
5
2 10
2 4
3 4
6 9
7 8
11
1
2
3
4
5
6
7
8
9
10
11

Answer:
-1
2
3
3
1
4
5
5
4
1
-1
Re: If you have WA5
Posted by Ealham 24 Feb 2019 19:44
SButterfly [Samara SAU] wrote 6 January 2015 23:12
Try this test:
5
2 10
2 4
3 4
6 9
7 8
11
1
2
3
4
5
6
7
8
9
10
11

Answer:
-1
2
3
3
1
4
5
5
4
1
-1


My code passes this test... Still getting WA5.
Re: If you have WA5
Posted by megacrab-3000 5 Jan 2020 19:55
The following test helped me to get AC:
7
2 8
2 6
3 3
6 6
7 7
8 8
9 10
10
1
2
3
4
5
6
7
8
9
10
Answer:
-1
2
3
2
2
4
5
6
7
7
I used points sorting + stack approach. My error was in sorting function: I didn't handle situation when points have the same coordinates, the same types, but belong to different segments. Once I added condition which deals with segment numbers, I got AC.
By the way, different compilers may give different results: my program compiled with visual studio gave correct results, while g++ did not.

Edited by author 05.01.2020 20:01