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

Автор awoo, история, 3 года назад, перевод, По-русски

1772A - A+B?

Идея: BledDest

Разбор
Решение (BledDest)

1772B - Matrix Rotation

Идея: BledDest

Разбор
Решение (BledDest)

1772C - Different Differences

Идея: BledDest

Разбор
Решение (BledDest)

1772D - Absolute Sorting

Идея: BledDest

Разбор
Решение (BledDest)

1772E - Permutation Game

Идея: BledDest

Разбор
Решение (Neon)

1772F - Copy of a Copy of a Copy

Идея: BledDest

Разбор
Решение (awoo)

1772G - Gaining Rating

Идея: BledDest

Разбор
Решение (adedalic)
Разбор задач Codeforces Round 839 (Div. 3)
  • Проголосовать: нравится
  • +50
  • Проголосовать: не нравится

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

By the way, a more "natural" way to deduce the relations for D (without doing a lot of casework) is to square both sides of the inequality, because if $$$|x| \leqslant |y| \Rightarrow x^2 \leqslant y^2$$$. This gives $$$(a_i - x)^2 \leqslant (a_{i + 1} - x)^2$$$ for all valid $$$i$$$. This implies that $$$a_i^2 - 2a_ix + x^2 \leqslant a_{i + 1}^2 - 2a_{i + 1}x + x^2 \Rightarrow (a_i^2 - a_{i + 1}^2) - 2(a_i - a_{i + 1})x \leqslant 0 \Rightarrow (a_i - a_{i + 1})(a_i + a_{i + 1} - 2x) \leqslant 0$$$, and then we can continue in the same way as editorial.

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

    It's more natural to just binary search the answer 185850639 (I suppose)

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

      interesting, could you explain your approach a bit in detail?

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

        First, let's denote min(a) as L, max(a) as H and M as (L + H) / 2, it's pointless to look for a solution where x > H or x < L because they will give array of the same (sortness) as H and L. try x = 5, 6 and x = 3, 2 on a = [5, 3, 5] for example, it'll give [0, 2, 0], [1, 3, 1] and [2, 0, 2], [3, 1, 3], respectively. every binary search loop iteration you loop through the array and check for any abs(M — a[i]) < abs(M — a[i — 1]) (which makes the result unsorted obviously), in case we found it we need to prolong the distance between M, a[i] and shorten it between M, a[i — 1] so we updaet H = M — 1 in case a[i] > a[i — 1] or L = M + 1 in case a[i] < a[i — 1]

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

    If you want to do it more natural, you can apply difference of squares identity: $$$a^2 - b^2 = (a - b)(a + b)$$$ i.e. $$$(a_i−x)^2\le(a_{i+1}−x)^2 \Leftrightarrow (a_i−x)^2 - (a_{i+1}−x)^2 \le 0 \Leftrightarrow (a_i - a_{i + 1})(a_i + a_{i + 1} - 2x) \le 0$$$

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

Добавлен перевод на русский разборов по ABCG. Прошу прощения за задержку.

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

I still don't understand the strategy used in Permutation Game. For me at least, the only possible outcome was a tie, because the other player can mess with the correct ordered ones. For example: 1 2 3 5 4 The first one colors 5 1 2 3 B5 4 The second colors any other to not let the first payer win B1 2 3 B5 4 The first color the last element B1 2 3 B5 B4 The second starts to mess the order of elements B5 2 3 B1 B4 And we have at least two elements out of order for player one, and it will require at least two first movements, but for any of them the other player will undo that movement. So what's the strategy?

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

For Problem G, why can we assume that we require a whole cycle in the reasoning for $$$x+k(p-m) \geq t_p$$$? What if $$$x$$$ exceeds $$$t_p$$$ mid-cycle? Then the number of wins in this particular cycle iteration would be $$$p+1$$$ and not $$$p$$$.

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

The checker got me wrong answer to have the array which is not in ascending order in question C. Is this a bug? 186207153

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

can someone confirm How many operations can we make in one second in codeforces ?