Блог пользователя niyaznigmatul

Автор niyaznigmatul, 6 лет назад, По-русски

Всем привет.

17 декабря в 10:00 MSK состоится второй отборочный тур олимпиады. Больше информации можно узнать на сайте олимпиады.

Текущая таблица результатов

Контест в тренировках: Отборочный этап Олимпиады Университета Иннополис. Второй тур. 2017-2018

2 декабря уже прошел Отборочный этап Олимпиады Университета Иннополис. Первый тур. 2017-2018. Тем, кто прошел в финальный этап по результатам первого тура, участвовать во втором туре не обязательно, но они могут это сделать, никак не повлияв на отбор. Призеры прошлых лет проходят в финал автоматически, зарегистрировавшись на соревнование. Также по результатам отборочных раундов пройдет отбор в Школу олимпиадной подготовки Университета Иннополис, информация по ней появится позже.

Спасибо тем, кто участвовал в первом отборочном туре, вас было много :). Это была одна из причин проблем с очередью тестирования. В этот раз мы постарались оптимизировать процесс и надеемся, что очереди не будет.

Предыдущие туры олимпиады можно найти по ссылке.

Задачи отборочного этапа готовили: dusja.ds, burakov28, julsa, KamilBek, josdas, budalnik, disa, lightning, VArtem, pashka, niyaznigmatul, FireZi, iilnar. Спасибо разработчикам PCMS за тестирующую систему, а также спасибо ilsaf13, который обеспечивает техническую поддержку олимпиады. Спасибо тем, кто прорешивал задачи: craborac, demon1999, haposiwe, zclimber, YakutovDmitriy.

После конца тура здесь можно будет обсудить решения задач.

Всем удачи!

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

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

Where can we find those who qualified from first round?
UPD: List of those qualified is here: https://olymp.innopolis.ru/ooui/innopolis-open-2017-2018/standings/all-final_en%20(1).html

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

zscoder, prepare your solutions beforehand, please.

»
6 лет назад, # |
Rev. 2   Проголосовать: нравится +5 Проголосовать: не нравится

For problem E, is there a deterministic approach? I used a probablistic one to try and find the best partition, but got only 50 points.

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

    Yes, sure. The problem can be reduced to Knapsack-problem, and since the weights are small enough (linear on the input length), it can be solved in polynomial time. You still have to do several optimization (they are deterministic) to get full score.

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

      Yes, I saw that with knapsack we can solve it in O(N2). What optimizations are you talking about?

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

        Note that there are not many distinct weights. Also use bitsets to restore solution.

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

    My solution works in time (which might be a bit tight but it managed to pass on first try.) and memory. Currently I'm not home so I don't have time to describe my entire solution but that should be my solution's complexity.

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

      I see. The weights represent differences between pairs, and the sum of all values of all pairs is N, therefor there are at most distinct values. So we can do knapsack in time, and in order to also maintain the actual sets we can use a bitset, which divides the memory by 32.

      By the way, the best way to pick coefficients is by picking primes, the coefficient 1 and the pairs {1, 0}, {1, 1}? This is what I did and I think it's optimal but I'm not sure how to prove it. Edit: nevermind it's actually easy to prove.

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

        Although there may be at most sqrt(n) different values, how do you update the dp with only O(1) each time for a value, even if that value has multiple occurrences?

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

          Let dp[i][j] be the minimum number of type j numbers to get a sum of i assuming we use first j types. (-1 if impossible)

          dp[i][j] = 0 if dp[i][j - 1] ≠  - 1.

          dp[i][j] = dp[i][j - a[i]] + 1 if dp[i][j - a[i]] ≠  - 1 and dp[i][j - a[i]] + 1 ≤ cnt[j] (cnt[j] is the number of elements of type j we can use)

          Note that you only need to store two rows of dp each time, so you can do this in O(N) memory. The state transitions are clearly O(1).

          Also, to restore the answers, you can use a bitset for each type as "parent" array to backtrack and find solution.

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

Hi! How to solve a problem B for 100% ? I solved it only for 17% . Can you give a hint or an algorithm ?

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

Where can I find problems? Can I submit somewhere?

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

Full solution to C. Credits: niyaznigmatul, 300iq.

If n and m are odd, answer is -1.
If sum of array is negative, answer is -1.
Otherwise, we can always find an answer.
Take an arbibtrary cycle. For example, when m is even we can take:

Similarly, when n is even we can take:

Write down numbers in this order and compute prefix sums p1, p2, ..., pn * m. Let k be the index of minimal number among them.
Now, repeat this cycle infinitely many times and compute prefix sums on it again — p1, p2, ..., pn * m, pn * m + 1, ..., p2 * n * m, ....
You can notice that there is no pi < pk for any i > k. From this you can infer that pi - pk ≥ 0 for all i > k. This means that we can take a cyclic shift of this cycle and put k-th element in the end and this will be the correct answer (since there will not be such i that p'i < 0, where p' is a prefix sum array for this new cyclic shift).

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

Can somebody show me code of B?

»
6 лет назад, # |
Rev. 2   Проголосовать: нравится -31 Проголосовать: не нравится

Where the editorial?

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

I'm strugglig with problem D (Road Building), I keep getting WA 47. Could anyone tell me some corner cases or point out y mistake please?

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

deleted