← Back to topics
Topic

z-rings

v
vasja
How to solve this problem?

I solved it for 70 points only .

In my solution i sorted the rings by comparison like this , if ring A can be put into ring B then A is before B.
If A can not be put in B and B can not be put in A then i sort by size of radius.

After that using something like dynamic programming and a map find the best solution.
g
gates
i used same solution and got full score.

ii sorted them by first radius..or if they are equal then by second radius.
a
adminModerator
The forum is public, so I wouldn't advise putting your email address here. you can use [at] and [dot], or put it as tex like this:

admin@z-trening.com

since in that case, it will be a picture instead of text, so the web crawlers won't be able to extract your email.
p
picsel
Try some small tests (like 1-2 rings) with big differences (1 000 000 000+) between inner and outter radius, maybe you find an error
v
vasja
10Q very much , i solved it. My first mistake was that i firstly misunderstood the problem and set the result to the beginning on 1 instead of the size of the first ring. Of course i forgot to fix it when i implemented the correct idea.
Another small mistake was that i didn't update the result when the solution consisted of only 1 ring. Thanks Picsel for this.
But still the positive thing is that my sort was correct:D yeeeey.
V
Velicue
Whoa, I stuck on this problem too.
m
marveringius
just remember: if you are sorting the rings, and if you need to search for the rings, DON'T use linear search.. Use some kind of modified binary search.. I was using linear search and getting TLE.. After modifing to binary search I got full score...