5

So 3 new problems - about trains and airplanes

 2 years ago
source link: https://www.codeabbey.com/index/forum_topic/28c4456060db79473aac65f6e44e399b
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

So 3 new problems - about trains and airplanes

Back to General discussions forum

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

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.

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

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK