Блог пользователя anup.kalbalia

Автор anup.kalbalia, 10 лет назад, По-английски

We hope you participated and enjoyed the changes made to monthly Long Contests.

From now on, we will be having the problem statements available in Mandarin Chinese and Russian as well

As always, the long contests will start on first Friday of every month and last for 10 days. This ensures that two weekends are covered.

Continuing from there, we bring you the CodeChef May Challenge 2014 . The May 2014 Algorithm Challenge is taking place on http://www.codechef.com/MAY14.

Here are the details:
Date: 2nd May 2014 to 12th May 2014
Duration: 10 days
Problems: 9 binary problems of varying difficulty levels + 1 challenge problem.

Problem Setters:

Problem Testers:

Editorialist:

Mandarin Translator:

Russian Translator:

It promises to deliver on an interesting set of algorithmic problems with prizes up for grabs.

The contest is open for all and those, who are interested, are requested to register in order to participate.

Check out the local time in your City/Time Zone here. Do share your feedback on what you feel about the new long contest format at feedback@codechef.com

Good Luck! Hope to see you participating.

  • Проголосовать: нравится
  • +12
  • Проголосовать: не нравится

»
10 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Разбора вроде ещё не видно. Как решать SEINC? Ничего лучшего чем дп за квадрат придумать не смог.

  • »
    »
    10 лет назад, # ^ |
    Rev. 3   Проголосовать: нравится +18 Проголосовать: не нравится

    Жадность.

    Во-первых давайте наш исходный массив превратим в в массив частичных сумм, тогда операцией является прибавить единичку в позиции i и вычесть единичку в позиции j > i. Причем j может быть равно n, то есть ничего в таком случае делать не надо.

    Теперь жадность такая: идем слева направо и храним сколько единичек мы уже прибавили на префиксе, пытаемся очередное число "убить"(то есть повычитать из него единицы) уже имеющимися. Eсли этого сделать не можем, то вспоминаем какое самое большое число a мы "убили" раньше и если это число больше текущего, то возвращаем a, и прибавляем к ответу 4 - a, а к числу свободных 4. Иначе прибавляем к ответу 4 - cur и к числу свободных тоже 4 - cur, то есть мы это число не сможем убить выгодно для нас. Понятнее кодом объяснить. Функция solveGreedy.

»
10 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

How to solve ANUDTQ? There is no editorial yet.

  • »
    »
    10 лет назад, # ^ |
      Проголосовать: нравится 0 Проголосовать: не нравится

    It can be solved easily using cartesian tree. Store the vertices in DFS order. To process first query you just need to insert new node in CT right after it's parent. To answer other queries you need to get the subtree of the given node. You can do this by storing depths of each vertex and minimal depth in subtree. You should first split CT by given node(it should go to the left tree). Then find the leftest vertex in the right tree whose depth is lesser or equal to depth of the given node and split by this vertex. Now all the queris are just add on segment, get sum of segment and delete segment. This is a standard CT problem.

»
10 лет назад, # |
  Проголосовать: нравится +3 Проголосовать: не нравится

The editorials are being posted here: http://discuss.codechef.com/tags/may14/