197 - Cube

All about problems in Volume 1. If there is a thread about your problem, please use it. If not, create one with its number in the subject.

Moderator: Board moderators

epsilon0
Experienced poster
Posts: 112
Joined: Tue Nov 12, 2002 11:15 pm
Location: Paris, France.

197 - Cube

Post by epsilon0 »

(way) down this board i saw someone say the output had to be sorted but it doesn't say so in the problem...

also, is there a trick to solve this problem faster? since the judge allows 600 seconds, i suppose not.... but i still got TLE
We never perform a computation ourselves, we just hitch a ride on the great Computation that is going on already. --Tomasso Toffoli
Ivor
Experienced poster
Posts: 150
Joined: Wed Dec 26, 2001 2:00 am
Location: Tallinn, Estonia

Post by Ivor »

if you read it the topic carefully, Ivan (if I remeber it correctly) also mentioned that the output does not have to be sorted. Elsewise why's the yellow checkmark for? And why do you think there's 600 seconds of time limit?? Take a look at the rank -- you'll see a time beyond 9 minutes!! And if you look at the date, you'll see that it was after the introduction of the ten seconds limit.

And there is a way of solving it very quickly, but I ain't gonna share it. :D

Happy solving,
Ivor
There is a theory which states that if ever anyone discovers exactly what the Universe is for and why it is here, it will instantly disappear and be replaced by something even more bizarre and inexplicable.
Ivan Golubev
Experienced poster
Posts: 167
Joined: Fri Oct 19, 2001 2:00 am
Location: Saint Petersburg, Russia

Post by Ivan Golubev »

Yes, I've firstly wrote that output must be sorted (because I forget about correction program) but then I've corrected this -- output need not to be sorted.

About speed-up -- you need to calculate all possible assemblies only once. So, short algorithm:
1. Fix part 'a' to translation only and generate all possible assemblies (480 variants).
2. Rotate each of these assemblies (24 ways to rotate cube) to get all possible states when part 'a' isn't fixed (so, total 11520 variants).
3. Now easily search this array to match with input and output correct 480 strings.

Part 1 can be precomputed and submitted in the source code, part 2 & 3 won't take too much time, so you can easily AC in less than a second.
Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Re: 197 - Cube

Post by Jan »

I am getting WA, but not understanding why. Is there any trick? Can anybody resubmit the problem just to be sure that the judge is correct?
Thanks.
Ami ekhono shopno dekhi...
HomePage
mf
Guru
Posts: 1244
Joined: Mon Feb 28, 2005 4:51 am
Location: Zürich, Switzerland
Contact:

Re: 197 - Cube

Post by mf »

I've resubmitted my old solution, and it gets accepted.
Jan
Guru
Posts: 1334
Joined: Wed Jun 22, 2005 10:58 pm
Location: Dhaka, Bangladesh
Contact:

Re: 197 - Cube

Post by Jan »

Thanks mf. Got accepted.
Ami ekhono shopno dekhi...
HomePage
Post Reply

Return to “Volume 1 (100-199)”