10709 - Intersection is Not that Easy

All about problems in Volume 107. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

windows2k
Experienced poster
Posts: 136
Joined: Sat Apr 05, 2003 3:29 pm
Location: Taiwan

Post by windows2k »

arif_pasha wrote: I pass all the input except this one.
Can you explain this input?
Can you give me more test input/output?
thx :)
0 0 10 0 LS
2 2 8 8 LS
0.00000
arif_pasha
New poster
Posts: 42
Joined: Fri Jun 13, 2003 3:47 pm
Location: Dhaka , Bangladesh
Contact:

Post by arif_pasha »

at long last.. ac :D
thanks to all
whisk
New poster
Posts: 4
Joined: Fri Sep 17, 2004 9:58 pm
Contact:

10709 definition

Post by whisk »

What it the correct definition for distance between two non-intersecting line segments? Is it the length of shortest perpendicular dropped from segment endpoint to another segment?
Per
A great helper
Posts: 429
Joined: Fri Nov 29, 2002 11:27 pm
Location: Sweden

Post by Per »

It is the minimal value of dist(p1, p2), where p1 ranges over all points in the first line segment, and p2 ranges over all points in the second line segment.
whisk
New poster
Posts: 4
Joined: Fri Sep 17, 2004 9:58 pm
Contact:

Post by whisk »

Thanks. I come from the same consideration but get WA and can't find what's wrong :(. Could anyone provide some test data, pls?
alex[LSD]
Learning poster
Posts: 53
Joined: Sat Jan 24, 2004 9:22 pm
Location: Tomsk, Siberia, RUSSIA
Contact:

Post by alex[LSD] »

Hah... Per's post seems really helpful 8-))))
Check out this test :
LS LS
0 0 1 0 // segm 1
2 2 2 -2 // segm 2
Answer = 1


and this one too
LS LS
0 0 1 0
2 1 3 1
Answer = sqrt(2)
The more contests are held, the happier I am.
whisk
New poster
Posts: 4
Joined: Fri Sep 17, 2004 9:58 pm
Contact:

Post by whisk »

2alex[LSD]: Those tests passed fine though your input format seems strange :)
whisk
New poster
Posts: 4
Joined: Fri Sep 17, 2004 9:58 pm
Contact:

Post by whisk »

AC at last. Of course, the trouble was in the input format :) There might be more that one space before "L/LS".
DJWS
Learning poster
Posts: 100
Joined: Sat Oct 11, 2003 3:30 pm
Location: Taiwan
Contact:

Post by DJWS »

I got WA several times but can't figure out the bugs. :cry:
Could someone offer me some test data?

--
DJWS, a newbiw in programming :wink:
DJWS
Learning poster
Posts: 100
Joined: Sat Oct 11, 2003 3:30 pm
Location: Taiwan
Contact:

Post by DJWS »

I got WA in problem 10514 River Crossing, even my program generated correct answer with the sample input.
(That's also a segment-intersection problem.)

I ponder if I make mistakes somewhere.
So depressed. :cry:

--
DJWS, a newbie in programming :wink:
DJWS
Learning poster
Posts: 100
Joined: Sat Oct 11, 2003 3:30 pm
Location: Taiwan
Contact:

Post by DJWS »

Finally got AC. :D
There are some problems that I have confronted:

1. Segment-intersection
I made mistake checking two co-linear segments.

2. Distance from a point to a line
At first I use the formula " |ax+by+c| / sqrt(a^2+b^2) " to calculate the distance, but this may cause precision error when calculating a, b, and c.
I tried to use "vector cross operation", and it works correctly. :wink:

3. Distance from a point to a segment
I used "vector dot operation" to determine if perpendicular distance is proper.
If not, the proper distance is just distance between the point and one endpoint of the segment.

Hope it helps someone getting WA. :wink:
--
DJWS, a newbie in programming :wink:
Larry
Guru
Posts: 647
Joined: Wed Jun 26, 2002 10:12 pm
Location: Hong Kong and New York City
Contact:

Post by Larry »

Anyone have more cases? I pass all the one on this board.. is precision an issue?
TISARKER
Learning poster
Posts: 88
Joined: Tue Oct 12, 2004 6:45 pm
Location: Bangladesh
Contact:

10709(Intersection is not that Easy) Wrong answer

Post by TISARKER »

I am getting wrong answer again and again.
Please Give me some critical Input.
Mr. Arithmetic logic Unit
bijon
New poster
Posts: 18
Joined: Thu Jan 06, 2005 2:12 pm

Post by bijon »

I cannot find the bug of my code.
please give some input and output data.[/b]
bijon
New poster
Posts: 18
Joined: Thu Jan 06, 2005 2:12 pm

Post by bijon »

I cannot find error in my code.
:( please give some input and output data.
Post Reply

Return to “Volume 107 (10700-10799)”