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

Обсуждение задачи 1614. Нацпроект «Трамваи»

Denis how to solve [17] // Задача 1614. Нацпроект «Трамваи» 1 апр 2008 16:48
is it possible to solve this problem with "smart" backtracking algo using a lot of restrictions ?
Chmel_Tolstiy Re: how to solve [15] // Задача 1614. Нацпроект «Трамваи» 1 апр 2008 16:58
As I know YES.
But there easy and beautiful math solution.
Denis Re: how to solve [14] // Задача 1614. Нацпроект «Трамваи» 2 апр 2008 17:31
give me a hint how to solve it without using backtracking algorithm

thank you
Chmel_Tolstiy Re: how to solve [13] // Задача 1614. Нацпроект «Трамваи» 2 апр 2008 17:51
ur e-mail ...
Denis Re: how to solve // Задача 1614. Нацпроект «Трамваи» 2 апр 2008 18:27
wetdrag@gmail.com
inkognito Re: how to solve [8] // Задача 1614. Нацпроект «Трамваи» 2 апр 2008 18:57
Please send it to me too.
eros_89@yandex.ru
Georgiy Savchenko Re: how to solve [7] // Задача 1614. Нацпроект «Трамваи» 2 апр 2008 21:58
About math solution.. I am trying to it by the following way:
Assume a connection between stops A and B. Then connection from B to A exists too. Then, to satisfy the problem's conditions, we have to introduce (2*n-1)*n connections (ordered in such a way that each tram route has 2*n-1 connections). All the connections are distinct.
Next, each tram stop has exactly 2*n-1 connections to other distinct stops. It is always odd integer, so every tram stop must appear exactly once at the beginning of single route, and next time it must appear (2*n-2)/2=n-1 times in the middle of other routes. It is true for all the routes.
So first we should build the following answer matrix if we consider n = 3:
1 x x x x 4
2 x x x x 5
3 x x x x 6

Then I am trying to place other elements to the matrix according to some placement rules from the thoughts above, but I am still unable to come up with a good solution.
Could someone point out, am I going correct in my math thoughts or such approach leads to naive backtracking solution? Thanks!
Sorry I was so verbose :D
Nick J Re: how to solve [5] // Задача 1614. Нацпроект «Трамваи» 3 апр 2008 16:47
No more math is needed. Now you can use backtracking.
Georgiy Savchenko Re: how to solve [4] // Задача 1614. Нацпроект «Трамваи» 3 апр 2008 18:00
I resisted the idea of writing a backtracking algo, but decided to implement it with rule of placing elements leftmost and outermost as you suggested and got AC :) Thank you.
PS. I wonder if it is possible to write a backtracking solution without any initial placements or not.

2 Chmel_Tolstiy: Could you please give me small hint about a math solution? master.wsd064 (no spam) gmail.com

Edited by author 03.04.2008 18:27
Chmel_Tolstiy Re: how to solve [3] // Задача 1614. Нацпроект «Трамваи» 3 апр 2008 19:25
your Idea is a 2/3 of all way. just try to find a regularity between this paths. I think it's easy.
Chmel_Tolstiy Re: how to solve [2] // Задача 1614. Нацпроект «Трамваи» 3 апр 2008 19:33
naxart[at]yandex[dot]ru

it's my email.
Stojcee Re: how to solve [1] // Задача 1614. Нацпроект «Трамваи» 2 июн 2008 05:27
I've found simple maths solution, here is my solution for n=3
1 2 3 4 5 6
2 4 6 1 3 5
3 6 2 5 1 4

Edited by author 02.06.2008 05:28

Edited by author 02.06.2008 05:28
Denis Koshman Re: how to solve // Задача 1614. Нацпроект «Трамваи» 25 июл 2008 17:30
There is no need for _smart_ backtracking. I placed 1..n on the left side and n..2n on the right side. Then I launched recursion over all cells row-by-row, column-by-column, taking every edge (i;j) exactly once, and it's AC in 0.078 sec.

For n=100 there occurs only 562 returns. So, it's almost greedy algo.

The only problem was expanding that recursion into a loop 'cuz I had stack overflow with 200x100 calls.

Edited by author 25.07.2008 17:31
yyll Re: how to solve // Задача 1614. Нацпроект «Трамваи» 17 июн 2021 22:24
Continue filling the matrix from both left and right.
Keep each pair of opposite columns contain every tram stops.
Peng Kejing Re: how to solve [2] // Задача 1614. Нацпроект «Трамваи» 23 ноя 2008 15:46
I want to know too.
pkkj@tom.com

Thanks.
svr Re: how to solve [1] // Задача 1614. Нацпроект «Трамваи» 27 июл 2009 11:15

Only math solution   acceptable
because this is structure design problem.
I spent a lot of time but was unable to find it.
Solution easy to find in internet with key words
"decomposing complete graph in hamilton paths"
Use diameters and  walk left-rigth- down with respect to them.

Edited by author 14.08.2009 11:02
svr Re: how to solve // Задача 1614. Нацпроект «Трамваи» 27 июл 2009 14:43
no subject

Edited by author 14.08.2009 11:03
Oracle[Lviv NU] Re: how to solve // Задача 1614. Нацпроект «Трамваи» 21 авг 2011 14:37
Nice article about graph decompositions.
http://people.qc.cuny.edu/faculty/christopher.hanusa/courses/634sp11/Documents/634ch2-3.pdf

Edited by author 21.08.2011 14:38