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 1281. River Basin

connected iff sharing point
Posted by Koala 9 Nov 2009 10:22
two rivers are considered to be connected iff they share at least one vertex (no matter inner vertex or end vertex)

example 1:
2
2
-1 0
1 0
2
0 1
0 -1
not connected, because their intersection (0, 0) is not a vertex of river 1 or river 2

example 2:
2
2
-1 0
1 0
3
0 1
0 0
0 -1
not connected, because (0, 0) is not a vertex of River 1

example 3:
2
3
0 1
0 0
0 -1
3
-1 0
0 0
1 0
connected, because (0, 0) appears on both rivers