So 3 new problems - about trains and airplanes

Back to General discussions forum

Rodion (admin)     2021-09-11 08:19:03
User avatar

Just to announce recently added problems:

Train Merge and Train Merge Advanced - proposed by our colleague Clive Fraser aka CSFPython.

Is the Earth Flat - pretty straightforward but involving some math / geometry - on popular modern theory.

CSFPython     2021-09-12 20:59:35

Rodion, Hi.

Is the Earth Flat is a nice new problem but I think you might need to correct one aspect of it.

You need to accept answers within a certain tolerance. At the moment you have a situation where the checker gets 7849 which rounds to 7800. If a user gets 7851 which rounds to 7900 their answer will not be accepted.

The simplest way of dealing with this is to ask for answers given as an integer and then allowing a tolerance of 50 or 100 between the answer submitted by the user and that of the checker.

The problem should be a real hit with all those flat earth fans out there!

Rodion (admin)     2021-09-13 06:15:15
User avatar

Clive, Hello and thanks for speedy feedback!

If a user gets 7851 which rounds to 7900 their answer will not be accepted.

Hm-m-m, this was not supposed to happen, since the testcase data are constructed starting with some specific radius (say 7800) and solver is expected to round to hundreds... i.e. it's already +/- 50.

However if your solution comes to different value, this may mean either rounding errors in the data generator are too large, or the solution uses some approach which loses precision too much.

I shall try to write solution myself and check :)

I had a look at your code though I'm not sure I understand much of it, but seemingly you use comparison by angles and binary search, that should be fine...

Meanwhile let me for start just increase input distance precision to 2 points after the dot. Please feel free to retry and tell if it makes things better!

CSFPython     2021-09-13 12:05:00

Rodion, Hi.

The increased precision on the data values has made all the difference. With the previous data I was getting answers which differed from the expected values by up to 70 or 80. Now they are well within the tolerance of 50. (errors no larger than 10)

I'm sorry that my program was unintelligible in places. It was written in rather a hurry. Despite that you clearly deduced what the algorithm was doing. Most of the rest of the code was just putting the input data into a convenient form for the algorithm to use.

Hopefully other people will notice this interesting new problem and have a go at solving it.

sontran     2021-09-28 07:25:53

Thanks for the new problems. Is the Earth Flat is very nice, especially to me with my pedestrian math skills.

Rodion (admin)     2021-09-28 12:39:00
User avatar

Thanks for feedback! I on contrary thought flat-earth problem will look very dull - wanted it to learn basics of spherical geometry myself (was totally ignorant and somewhat afraid of it before). Hm-m-m, but now we again have at least one person who solved everything. Should do something about it... :)

Please login and solve 5 problems to be able to post at forum