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

Автор Rox, 3 года назад, По-русски

Всем привет!

В настоящее время проходит квалификация Yandex Cup в направлении «Алгоритм».
Квалификация проходит в двух форматах: спринт и марафон.
Оба соревнования завершатся в понедельник, 7 ноября 2022 г. в 23:59 (МСК).

Как автор одной из задач, приглашаю всех поучаствовать.

Информацию про другие треки Yandex Cup можно найти на сайте.

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

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

As a tester, I invite you all to participate in the competition! :)

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

What's the difference between sprint and marathon in Yandex Cup context, I couldn't find info on site

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

Is there any T-shirts for finalists? :)

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

I have several questions for the final round:

  1. What time is it going to be?
  2. What is the duration?
  3. Is it going to have flexible timer (like the qual round) as well?

The website seems to be lacking information.

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

Wow. Problem A from hell in today's Final Round for me… Tried 2 super-convoluted DP approaches, and ultimately couldn't make it work. That was an unexpected level of complexity after solving 4 Qual problems. Any slight hints for A?

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

    Greedy :)

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

    Problem A. Max and the erudite competition

    For solving this problem you should think as a coach. You can start from something simple.

    hint #1: simple start

    My C++ solution

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

    Alternate approach cause I kept messing up my greedy lol:

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

Will there be an editorial? I want B and C. Thanks.

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

    C: Fix N mod 3 (let's call it r) and binary search on N. For each prime factor of A, calculate how many times p^a is a factor of N!!! for each a >= 1 and add them up to get the total exponent of p in N!!!.

    This can be done by counting the number of solutions to p^a | (3k + r). If p is 3, then we need r = 0 and k is a multiple of p^(a-1). If p is not 3, then the solutions will be k = p^a * anything + i, where i is whichever of (-r)/3, (-r + p^a) / 3, or (-r + 2p^a) / 3 is an integer.

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

Will there be an awards ceremony? Also, will the problems be available for upsolving?

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

Open upsolving please.

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

А есть дорешка backend трека?
А будут ли футболки?

Полажуйста, на будущее, вычитывайте условие тщательнее, чтобы не было никаких разночтений. 5 кларов на 4 задачи это СЛИШКОМ много. В квалификации то же самое было — пожалуйста, догадайтесь, что от вас хотят в этой задаче. Примеры? Да, есть, только они покрывают совсем не все случаи.
Также очень странно видеть лагающий я.контест при 115 участниках. Мне не кажется, что в других треках сильно больше участников, чтобы сайт был недоступен под такой "большой" нагрузкой.
К счастью, не могу сказать ничего плохого про задачи, разве что выбор sql для С очень сомнительный. Задача не проверяет ничего, кроме умения гуглить как описать ту или иную конструкцию на sql.

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

How to solve E?

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

What's the intended time complexity for F? I managed to pass $$$O(N^{5/3})$$$ but it took quite a bit of constant optimization.

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

    I will assume that $$$n = q$$$, expected complexity is $$$O(n\sqrt{n})$$$, but TL wasn't strict.

    Let's replace $$$r$$$ by $$$\frac{r}{k}$$$ and name value that we need to calculate as $$$F(r, d)$$$.

    It's easy to calculate $$$F(r, d)$$$ from $$$F(r - 1, d)$$$, main trick is that we are able to calculate $$$F(r, d)$$$ from $$$F(r, d - 1), \ldots, F(r, d - k + 1)$$$.

    Do to this, let's notice that:

    $$$\binom{x}{d}=\sum^{i=k}_{i=0} \binom{x - k}{d - i}\binom{k}{i}$$$

    It's basically Vandermonde's identity.

    Let's sum both parts for $$$x$$$ divisible by $$$k$$$ and not greater than $$$(r + 1) \cdot k$$$, we will get:

    $$$\binom{(r + 1)\cdot k}{d} = \sum^{i=k}_{i=1} F(r, d - i)\binom{k}{i}$$$

    (I moved part with $$$i = 0$$$, because evething except $$$\binom{(r + 1)\cdot k}{d}$$$ will cancel out).

    From here, we can find $$$F(r, d - 1)$$$, if we know $$$F(r, d - 2), \ldots, F(r, d - k)$$$.

    Let's go back to original problem.

    We will also assume that $$$k \le \sqrt{n}$$$, otherwise we can calculate answer for each query in $$$O(\frac{n}{k})$$$ with total complexity $$$O(\frac{n^2}{k})$$$.

    To solve the problem, let's fix some value of $$$B$$$ and calculate all values of the form $$$F(i \cdot B, x)$$$ for $$$x \le n$$$.

    To do this, let's calculate $$$F(i \cdot B, x)$$$ for $$$x \lt k - 1$$$, we can easily do it in $$$O(\frac{n}{k} \cdot k) = O(n)$$$ for all $$$i$$$.

    Then, for each $$$i$$$ we can find the remaining values in $$$O(nk)$$$(recovering $$$F(i\cdot B, d)$$$ from $$$F(i \cdot B, d - 1), \ldots F(i \cdot B, d - k + 1)$$$), so in total this part takes:

    $$$O(nk \cdot \frac{n}{kB}) = O(\frac{n^2}{B})$$$.

    Then, if we have the query $$$r, d$$$, let's just find largest $$$i$$$ such that $$$i \cdot B \le r$$$ and calculate answer from $$$F(i \cdot B, d)$$$ in $$$O(B)$$$. So, total complexity for queries will be $$$O(nB)$$$. Choosing $$$B = \sqrt{n}$$$ gives the desired complexity.

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

      Cool, the implementation is very short.

      Where did you get $$$O(\frac{n}{kB}\cdot k)$$$ from? I know how to do it in $$$O(k^2)$$$ per $$$i$$$ using the formula you provided (for a total of $$$O(\frac{n}{kB}\cdot k^2)$$$).

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

        Sorry, it was wrong, I think it's easier just to do it naively for every fixed value of $$$x$$$ resulting in $$$O(\frac{n}{k}\cdot {k}) = O(n)$$$ (your way is faster, but of course it doesn't change complexity).

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

    another passed solution that runs in time complexity $$$\mathcal{O}(n \sqrt{q \log n / k})$$$, where $$$n = \max(r)$$$. also took a bit of constant optimization on it.

    let $$$T$$$ be the block size, and $$$F_u(x) = \sum_{i = 1}^{u T}(1 + x)^{i k}$$$. After preparing the first $$$n$$$ factorials and their inverse, we iterate for each $$$u = 0, 1, \ldots, \lfloor n / k / T \rfloor$$$ and process queries with $$$u k T \leq r \lt (u + 1) k T$$$ using $$$[x^d] F_u(x)$$$ and at most $$$T$$$ extra binomial coefficients, so the total complexity will be $$$\mathcal{O}(n + n^2 \log n / k / T + q T)$$$, which has a minimal value when $$$T = n \sqrt{\log n / k / q}$$$.

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

Получил на днях футболку. Прекрасная футболка, качество класс. Только вот почему-то М-ка размером даже больше чем все мои растянутые со временем L-ки. Это так и задумано? Я даже не представляю какого размера тогда L... Хотелось бы как-то обменять на S или даже XS, раз уж такая размерная сетка