Search found 18 matches

by Mart
Wed Jul 10, 2002 4:15 pm
Forum: Volume 1 (100-199)
Topic: 191 - Intersection
Replies: 103
Views: 33381

I was referring to the line:
if( x>=x1 && x<=x2 )
/* && (point_in_linesegment(x,y1,xstart, ystart, xend, yend) == 1) ) */
{ printf("T\n");
return;
}

and similar. I think you need the commented out part in them.
e.g.
1 1 10 10 20 1 80 80
F

I agree you need to compare 2 floats, but it's *how ...
by Mart
Wed Jul 10, 2002 1:46 pm
Forum: Volume 1 (100-199)
Topic: 191 - Intersection
Replies: 103
Views: 33381

Why have you commented out the point_in_line_segment checks for checking the top line of the rectangle onwards? This gives wrong answers for several cases.

I can get your previous program accepted with the minimum of changes. You need to be looking at float accuracy: in floats, (a/b)*b != a ...
by Mart
Wed Jul 10, 2002 2:21 am
Forum: Volume 1 (100-199)
Topic: 191 - Intersection
Replies: 103
Views: 33381

Hmm - there are a few obvious errors in your code.

e.g. Some printf statements without a return or continue after them

you use:
if (a1+b1 == len)
with floats - not a good idea. You might want to consider how floating point accuracy (or lack of it) might be affecting you. (Actually my code was ...
by Mart
Tue Jul 09, 2002 2:01 pm
Forum: Volume 1 (100-199)
Topic: 191 - Intersection
Replies: 103
Views: 33381

Ok the obvious similar special case to the previous ones:

5 5 5 5 4 4 6 6

T

Now I couldn't quite see where you were missing this at first, because you appear to cover all the relevant cases, but then I realised that you've misunderstood the problem. Go back and read the description again, in ...
by Mart
Mon Jul 08, 2002 11:47 pm
Forum: Volume 1 (100-199)
Topic: 191 - Intersection
Replies: 103
Views: 33381

Ok, how about:

1 1 10 10 6 5 8 5

F

You have code to cover this case (and similar ones) but it is wrong.
by Mart
Mon Jul 08, 2002 2:17 pm
Forum: Volume 1 (100-199)
Topic: 191 - Intersection
Replies: 103
Views: 33381

How about:

4 9 11 2 12 5 1 5
4 9 11 2 4 9 4 9

result:
T
T
by Mart
Sun Jul 07, 2002 10:53 pm
Forum: Volume 1 (100-199)
Topic: 191 - Intersection
Replies: 103
Views: 33381

You still fail the case:
4 9 4 7 1 5 7 1
which should return F

In your code:
It can fail for topleft1==bottomright1 or topleft2==bottomright2

You have some ambigious IF IF ELSE statements.

> if( (( x== xend)&&(y = yend) )||( (x == xstart)&&(y == ystart) ) )
Should be y==yend.

Vertical (or ...
by Mart
Sun Jul 07, 2002 12:59 am
Forum: Volume 1 (100-199)
Topic: 191 - Intersection
Replies: 103
Views: 33381

if( topleft1 < bottomright1)
{ x1 = topleft1;
y1 = topleft2;
x2 = bottomright1;
y3 = bottomright2;
}
else
{ x1 = bottomright1;
y1 = bottomright2;
x2 = topleft1;
y3 = topleft2;
}

It's not enough to compare just the X values. You need to compare the X and Y values independently ...
by Mart
Fri Jul 05, 2002 2:59 pm
Forum: Volume 1 (100-199)
Topic: 191 - Intersection
Replies: 103
Views: 33381

You are correct.
by Mart
Wed Jul 03, 2002 3:27 am
Forum: Volume 1 (100-199)
Topic: 168 - Theseus and the Minotaur
Replies: 64
Views: 15100

I'm not certain of my tests (I might double check later if I have time) but I think that there are cases of the form A:B:C:E; as you suggest.

Making this A:B;C:E; doesn't work. A:BCE; also doesn't work (note - I'm assuming that the rest of my program is basically ok as it was previously accepted ...
by Mart
Tue Jul 02, 2002 2:09 pm
Forum: Volume 1 (100-199)
Topic: 191 - Intersection
Replies: 103
Views: 33381

Firstly, you need that extra code.
Secondly, strange to go with x1<=x2 but y1>=y2, it's bound to cause confusion in your maths, but whatever.
Thirdly, try:

1
4 9 4 7 1 5 7 1

correct output:
F
by Mart
Tue Jun 25, 2002 1:06 am
Forum: Volume 1 (100-199)
Topic: 168 - Theseus and the Minotaur
Replies: 64
Views: 15100

Hmm. Well my tests indicate that there is always a path from Theseus to the Minotaur, but sometimes not from the Minotaur to Theseus. Which is still inconsistent with the description of the problem, but you could carry on from that point with Theseus giving chase (which still gives WA, so it must be ...
by Mart
Fri Jun 21, 2002 7:23 pm
Forum: Volume 1 (100-199)
Topic: 168 - Theseus and the Minotaur
Replies: 64
Views: 15100

Hi,

if you've got PE you're doing best than most of us... (even if you can't remember the code).

I don't agree about the problem description. It seems pretty clear from that point of view to me. It doesn't say that Theseus lays down a candle in the first cave.

In your code extra white space in ...
by Mart
Tue Jun 18, 2002 11:59 pm
Forum: Volume 1 (100-199)
Topic: 136 - Ugly Numbers
Replies: 156
Views: 41693

I just cut and pasted your code and got AC (although it's not the quickest implementation in the world... ;)

Are you sure you've set up the problem number correctly in the code?
i.e. a line like:

/* @JUDGE_ID: *yourID* 136 C */

Failing that it is probably a problem with your email. Try sending ...
by Mart
Wed Jun 12, 2002 8:51 pm
Forum: Volume 1 (100-199)
Topic: 178 - Shuffling Patience
Replies: 15
Views: 5147

there is no space after the "no", so the description is correct
(format is "... card no%3d")

(that's not to say there wasn't a space there last month, but it's correct now at least...)

Go to advanced search