Problem 212

A place to air possible concerns or difficulties in understanding ProjectEuler problems. This forum is not meant to publish solutions. This forum is NOT meant to discuss solution methods or giving hints how a problem can be solved.
Forum rules
As your posts will be visible to the general public you
are requested to be thoughtful in not posting anything
that might explicitly give away how to solve a particular problem.

This forum is NOT meant to discuss solution methods for a problem.

In particular don't post any code fragments or results.

Don't start begging others to give partial answers to problems

Don't ask for hints how to solve a problem

Don't start a new topic for a problem if there already exists one

Don't post any spoilers
sivakd
Posts: 217
Joined: Fri Jul 17, 2009 8:37 am
Location: California, USA
Contact:

Re: Problem 212

Lord_Farin wrote:You may want to notice that the volume of a cuboid is not the same as the amount of lattice points contained in it. That is what led to your confusion, I believe. Since planes have volume zero in 3D, it does not matter if we include the boundary of the cuboid or not: the volume stays the same.
Lord_Farin, thanks for the explanation. I am somehow still not convinced. Put it differently two solid objects can occupy the same point as per this definition if they are adjacent.

puzzle is a euphemism for lack of clarity

TripleM
Posts: 382
Joined: Fri Sep 12, 2008 2:31 am

Re: Problem 212

Sure they can - there is a lot of overlapping of cuboids in this problem, which is the point (to calculate the volume of the union). The problem doesn't say the cuboids can't share points (in fact, if they couldn't, the problem would be trivial, since you'd just add the volumes of each cuboid).

If you were asked to draw a lot of squares on a piece of paper then calculate the area of the union, it doesn't make a difference whether you include the edges or not - the area is the same. And there will definitely be squares sharing the same points. Exactly the same here, but with cuboids.

sivakd
Posts: 217
Joined: Fri Jul 17, 2009 8:37 am
Location: California, USA
Contact:

Re: Problem 212

Thanks Guys, working on a problem till late into the night can make you dumb .

puzzle is a euphemism for lack of clarity

OskarS
Posts: 6
Joined: Tue Nov 01, 2011 11:17 pm

Re: Problem 212

I've figured out an algorithm for this problem, and the code I wrote gives the correct answer for n=100 and for n=1579 that was provided earlier in this thread, but it gives the wrong answer for the full n=50000 problem. Could I message someone here with some other values, just to see if I can figure out where I'm going wrong?

OskarS
Posts: 6
Joined: Tue Nov 01, 2011 11:17 pm

Re: Problem 212

Nevermind, I figured out what I was doing wrong and I've solved it now

Waldovski
Posts: 28
Joined: Thu Jul 08, 2010 10:11 am

Re: Problem 212

Don't know if this is OK to ask, but can this be done in better than $O(n^2)$?