ENG  RUSTimus Online Judge
Online Judge
Задачи
Авторы
Соревнования
О системе
Часто задаваемые вопросы
Новости сайта
Форум
Ссылки
Архив задач
Отправить на проверку
Состояние проверки
Руководство
Регистрация
Исправить данные
Рейтинг авторов
Текущее соревнование
Расписание
Прошедшие соревнования
Правила
вернуться в форум

Обсуждение задачи 1878. Кубик Рубинчика

WA3
Послано morbidel 22 окт 2011 16:05
Any hint for WA3?
Re: WA3
Послано Anil Kishore 22 окт 2011 16:21
'm stuck with WA5 :(
Re: WA3
Послано ZARHANE 22 окт 2011 17:41
I have WA40 !
Re: WA3
Послано Strekalovsky Oleg [Vologda SPU #1] 23 окт 2011 23:43
Anil Kishore писал(a) 22 октября 2011 16:21
'm stuck with WA5 :(
Don't forget rotate clockwise and anticlockwise at one step!
Re: WA3
Послано morbidel 24 окт 2011 16:20
Yes, rotating just 90 degrees in either directions takes one step. What's the trick here?
Re: WA3
Послано MOPDOBOPOT (USU) 25 окт 2011 13:49
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
Послано morbidel 25 окт 2011 15:15
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
Послано morbidel 26 окт 2011 00:00
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
Послано morbidel 27 окт 2011 01:13
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
Послано Lucian Ilea 7 ноя 2011 21:37
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
Послано Soucup Adrian 29 июн 2012 20:52
Lucian Ilea писал(a) 7 ноября 2011 21:37
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
Послано Squire [Lviv NU] 29 авг 2012 23:21
Soucup Adrian писал(a) 29 июня 2012 20:52
Lucian Ilea писал(a) 7 ноября 2011 21:37
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
Послано Squire [Lviv NU] 29 авг 2012 23:31
MOPDOBOPOT (USU) писал(a) 25 октября 2011 13:49
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
Послано MOPDOBOPOT (USU) 30 авг 2012 00:09
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
Послано Squire [Lviv NU] 30 авг 2012 01:16
MOPDOBOPOT (USU) писал(a) 30 августа 2012 00:09
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
Послано inatial_D 5 мар 2013 16:55
ac is reached just using 4 elements in inputs.
Re: WA3
Послано tepamid 2 июл 2019 19:32
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
Послано maslowmw 17 май 2020 00:33
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.