Re: WA3

'm stuck with WA5 :(

Re: WA3

Posted by

ZARHANE 22 Oct 2011 17:41

I have WA40 !

Re: WA3

'm stuck with WA5 :(

Don't forget rotate clockwise and anticlockwise at one step!

Re: WA3

Yes, rotating just 90 degrees in either directions takes one step. What's the trick here?

Re: WA3

This test helped me to overcome WA3:

4 2 2 3

3 1 4 1

3 2 3 1

1 4 4 2

The answer is 4. Because collect '4' needs 5 steps, but collect '1' needs only 4 steps.

Re: WA3

My answer is 4.

I made a classic backtracking which gets WA3 and also a Greedy who also gets WA3, which works as follows:

- assume the square is solved with 1 in the upper left corner, compute the orientation of each of the layers (0 if ok, 1 or 3 if with a rotation we reach 1 in the corner, 2 if with 2 rotations).

- now try to rotate the layers to achieve the color i in the upper left corner

- so for each layer determine the minimal nr. of steps to move the color i from layer j in its correct position

- compute the minimal number of moves to reach the solution with color i in upper-left

- print the minimum out of those values

*Edited by author 25.10.2011 15:22*

Re: WA3

I figured out the test #3, it has T[0][0] = 2, T[0][1] = T[1][0] = 1, T[1][1] = 3, "if (...) while(1);" did the trick.

So the whole table I assume is

2 1 2 4

1 3 1 2

3 4 2 4

1 3 4 3

My program outputs 2 as a minimum (rotate layer 4 clockwise with 90, rotate layer 3 anti-clockwise with 90), resulting a solved cube with 1 in its left corner. The judge answer is 3, but I don't understand why.

Am I missing something?

*Edited by author 26.10.2011 00:04*

Re: WA3

AC at last! The problem in my solution was that I assumed always that the colors were 1-red, 2-yellow, 3-green, 4-blue, but they say that one number is one color so they could be permuted in any way.

*Edited by author 27.10.2011 01:55*

Re: WA3

My AC program gives 2 as the answer for:

2 1 2 4

1 3 1 2

3 4 2 4

1 3 4 3

Re: WA3

My AC program gives 2 as the answer for:

2 1 2 4

1 3 1 2

3 4 2 4

1 3 4 3

Strange. Mine gives 3. (Also AC).

*Edited by author 29.06.2012 20:52*Re: WA3

My AC program gives 2 as the answer for:

2 1 2 4

1 3 1 2

3 4 2 4

1 3 4 3

Strange. Mine gives 3. (Also AC).

*Edited by author 29.06.2012 20:52*It's obvious that the answer is 2. Bad tests :)

Re: WA3

This test helped me to overcome WA3:

4 2 2 3

3 1 4 1

3 2 3 1

1 4 4 2

The answer is 4. Because collect '4' needs 5 steps, but collect '1' needs only 4 steps.

You're wrong. The answer is equal for every colour cause you cann't collect only one colour but all the colours together.

To collect '4' you must turn left inner square and turn right two outer squares each for 1 time. So we have 3 steps in sum.

P. S. Sorry for bad english (

*Edited by author 29.08.2012 23:31* *Edited by author 29.08.2012 23:31* *Edited by author 29.08.2012 23:33*Re: WA3

If we turn squares as you said we will get this situation:

4 3 3 3

4 4 3 2

4 1 2 2

1 1 1 2

Re: WA3

If we turn squares as you said we will get this situation:

4 3 3 3

4 4 3 2

4 1 2 2

1 1 1 2

Yes, you're right )))

We need one more step - turn right the square which includes element table[3][1]. So, the answer is 4.

Re: WA3

ac is reached just using 4 elements in inputs.

Re: WA3

Mine gives 2 and I got AC for this input:

2 1 2 4

1 3 1 2

3 4 2 4

1 3 4 3

*Edited by author 02.07.2019 19:33*

Re: WA3

But this test incorrect, because always colours order 1-2-3-4

IN this tet 1-2-4-3.

My AC solution also gives 3.