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

Обсуждение задачи 1433. Тетраэдры

Sergiy_PMI_31 [Lviv NU] Strange algo for solving this problem [3] // Задача 1433. Тетраэдры 28 июл 2006 12:23
There is some strange algo, but AC.
let we have two arrays of char[5];
Then we compare first diamond with SOME permutations of second, but that permutations is 1234 1342 1423 2143 2314 ... i.e. we miss two permutations of lexicographic sequence of all permutations, the take two, then miss two again.
    int compare_condition = 1;
    while (1)
    {
        if (compare_condition < 2) compare(diamond1, diamond2);
        if (eq){
            cout << "equal" << endl;
            return 0;
        }
        compare_condition++;
        compare_condition %= 4;
        if (!next_permutation(p.begin(), p.end())) break;
    }
This code works, but why???
Can anybody prove it???
Strange algo, isn't???
ILIA Re: Strange algo for solving this problem [2] // Задача 1433. Тетраэдры 18 дек 2007 21:11
ATTENTION, PEOPLE! IT IS WRONG !!!


Edited by author 18.12.2007 21:12
ILIA Re: Strange algo for solving this problem [1] // Задача 1433. Тетраэдры 18 дек 2007 21:13
WA#12
Denis Koshman Re: Strange algo for solving this problem // Задача 1433. Тетраэдры 26 июл 2008 23:32
Strange indeed :)))