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

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

1879A - Подстроено!

Идея: Roms

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

1879B - Фишки на доске

Идея: BledDest

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

1879C - Чередуй!

Идея: Roms

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

1879D - Сумма функций XOR

Идея: Roms

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

1879E - Интерактивная игра с раскраской

Идея: BledDest

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

1879F - Остаться в живых

Идея: BledDest

Разбор
Решение (awoo)
  • Проголосовать: нравится
  • +76
  • Проголосовать: не нравится

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

Clear editorial!

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

Clear Editorial, but it should have appeared in a more clear place lmao

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

D was pretty fun

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

There is a question on task D, why we don't take into account carry-over units from previous digits when counting the i-th bit? Thanks in advance.

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

F was really fun

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

In D's editorial, if pref(x) is equal to the number of ones on the prefix of length x modulo 2, then for even number of ones, shouldn't pref(x) be 0?

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

E is so cringe

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

For anyone else struggling to formalize why their intuition for B leads to an optimal arrangement of chips:

The key insight is what the tutorial notes -- a valid chip arrangement must satisfy either (1) each row has at least 1 chip or (2) each column has at least 1 chip.

Now, we have two cases.

Say we have a valid chip arrangement that satisfies (1). Then, we can make an arrangement that is as cheap or cheaper by removing any extra chips so that each row has exactly one chip (vs. at least one). From here, observe that the cheapest 1-chip-per-row arrangement is the one you get by picking the cheapest column and filling each cell in it with a chip. Any other 1-chip-per-row arrangement is more expensive because there will be a chip in the same row, but a more expensive column.

Similarly, say we have a valid chip arrangement that satisfies (2). Then, we can make an arrangement that is as cheap or cheaper by removing any extra chips so that each column has exactly one chip (vs. at least one). From here, observe that the cheapest 1-chip-per-column arrangement is the one you get by picking the cheapest row and filling each cell in it with a chip. Any other 1-chip-per-column arrangement will be more expensive because there will be a chip in the same column, but a more expensive row.

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

    Proof of the insight: Suppose that there is at least one row missing and at least one column missing. You can then pick a cell such that the cells location is (missing row,missing col) which isn’t covered.

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

In problem F, it's not necessary to use a sparse table. It is enough to store 2 maximums for every suffix and for a segment [l, r] we can take suff max on [l, a]. This works because if exist some hj >= hi, where l <= i <= r and j > r, we will get j's real value in a different segment and this value will be definitely greater than i's

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

Thanks to the authors for their work on this round :)

Here is my advice about the problems

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

Nsqrtn pass on F:225085205

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

In problem D, can someone please explain how are they handling 1 in (r — l + 1) while computing the answer ?

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

    I'm having the same problem over the past two days.

    i can get the Xor sum of all subarrays but intervalls is pretty hard for me .

    did you get it ?

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

      I inferred it this way.

      As we know (r — l + 1) is the length of the subarray and we are computing the prefix sums on the bits-array comprising of 0s and 1s. If you look at the editorial code, the sumOfL[x] denotes the sum of lengths of subarray where parity of count of 1s is x. Now, if for the given r, let say there are 3 subarrays with odd count of 1s. Then our ans is (1 << b) * 3 * r — (1 << b) * (sum of l values for those 3 subarrays). We compute length from the difference of lengths of subarray ending at r — subarray ending at l.

      Hope that helps or atleast give you some direction.

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

How are we colouring a bamboo (All nodes having one child except the last one) in E ?

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

My approach on C: If we consider a maximal block of same character sequence of size say $$$l$$$ then the number of ways we can pick an element to survive in that block is $$$l$$$ ways, after which there exists $$$(l-1)!$$$ arrangements to delete the remaining elements in the block. Hence there exists a total of $$$(l - 1)! \times l = l!$$$ ways within the block to perform the valid operation. And if there are $$$k$$$ such blocks then there exists a total of $$$\prod_{i}^{k}l_{i}!$$$ valid operations.

This approach fails however, not sure why. Any help/corrections appreciated!

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

Hey can any one help me out here, getting WA on testcase 6 for Problem D submission

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

Solving D made me cry .I hate u codeforces.

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

mfw xor is not distributive over sums

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

The way you write the editorial, makes it super easy to understand. Thanks a lot BledDest & Roms