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

Обсуждение задачи 1100. Таблица результатов

does only by M ?
Послано dibrov.bor[SumySU] 5 ноя 2008 00:10
I made solution using stack to store ID data so after sorting by M all ID rows keep sorted in reverse way they meet in input and I got WA1
than I replace stack to queue by replacing "stack" to "queue" and ".top()" to ".front()" only and I got WA2
actually I find nothing in statement about order of ID rows with equal M
Re: does only by M ?
Послано djosacv 21 дек 2008 23:19
the order of id rows with same M is implicit in the statement when is said that your sorting algorithm must generate the same ordering that bubblesort generates. Bubblesort is a stable sorting algorithm (it doesn't change the order of records with same keys). So you should use a fast stable sorting algorithm (by the way the usual implementations of quicksort and heapsort aren't stable). Binary-tree and mergesort are stable. Insertion sort also.