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

Обсуждение задачи 1656. Войско Тридевятого царства

what is the algorithm :?
Послано 59838AD 18 ноя 2008 21:43
Re: what is the algorithm :?
Послано Artem Litvinenko SSU 19 ноя 2008 01:11
the algorithm consist of transposition the most high soldier to the centre of the line and to the centre of the column. in cycle from 1 to n gives bubble sorting.
Re: what is the algorithm :?
Послано melkiy 11 мар 2009 07:05
Please can you explain how to do bubble sort in 2-d array here?
algorithm
Послано melkiy 11 мар 2009 07:14
I constructed such an algorithm. It requires the soldiers to be sorted by their height downwards.

When the soldiers are sorted, take them one by one and fill the square diamond by diamond, starting from center.
A "diamond" contains those cells (x,y) for which
|x - x_center| + |y - y_center| == C,
C ranges [0; n-1].

Edited by author 11.03.2009 08:54
Re: algorithm
Послано Michail Yudin 11 апр 2009 19:42
it's no solution
Re: algorithm
Послано Daniel Mahu 10 дек 2011 04:47
There is a much simpler method, which also uses less memory.

Hint: try a O(n) sort.
Also try not to store n*n elements in memory (print line by line instead).