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

Обсуждение задачи 1795. Мужья в магазине

Admins, please check test 8 for submission 4909253 on Java
Послано d3m0n1c 19 апр 2013 04:13
Or give me some tests please.
All tests that were proposed on the forum shows correct result.
The main loop is:

        while (head != n) {
            if (id[head] != -1) {
                int have = shop[id[head]].count;
                if (have > 0) {
                    if (want[head] > have) {
                        if (head == n - 1) {
                            ++time;
                            break;
                        }
                        swap(id[head], id[head + 1]);
                        swap(want[head], want[head + 1]);
                        want[head + 1] = have;
                    } else {
                        shop[id[head]].count = have - want[head];
                        ++head;
                    }
                } else ++head;
            } else ++head;
            ++time;
        }

Edited by author 19.04.2013 14:14

Edited by author 19.04.2013 14:14
Re: Admins, please check test 8 for submission 4909253 on Java
Послано Alexey Dergunov [Samara SAU] 20 апр 2013 21:20
I think that the problem is in the function swap() which doesn't work in Java.
Re: Admins, please check test 8 for submission 4909253 on Java
Послано d3m0n1c 27 апр 2013 00:39
Your guess is wrong. I wrote swap method. Also I used my own hashing. Maybe this is the root cause.