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

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

1901A - Поездка

Идея: BledDest

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

1901B - Фишка и лента

Идея: Roms

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

1901C - Прибавь, раздели и округли

Идея: BledDest

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

1901D - Очередное сражение с монстрами

Идея: BledDest

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

1901E - Сжатие дерева

Идея: BledDest

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

1901F - Благоустройство

Идея: adedalic

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

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

In problem D, I am struggling to understand the statement. According to my perception, the answer to the first test case should be 7. I will choose i = 4. The chain of the indices to strike will be like 4->3->5->6->2->1. Please someone correct me.

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

Reached Specialist, in this round.

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

problem E is a art.

It takes a lot of effort to achieve perfection in whatever any direction.

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

for C, if we have min = 2 & max = 11. since min is even then x=0 & min = 1, max = 5 now if I go according to the editorial. it would take a total of 4 steps (1,3 -> 1,2 -> 1,1). but when min = 1 & max =5, I can take x =0 and reduce in 1 step less (1,2 -> 1,1) total of 3.

am I missing something here?

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

Problem D: If it's necessary to check all indices as a first target point (according to tutorial), then why problem statement says that "Vasya chooses the first target optimally"?

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

[Problem C] Can someone help me understand why choosing $$$x$$$ as the average between $$$max$$$ and $$$min$$$ (or $$$a$$$ and $$$b$$$) doesn't work?

I guess it has somethings to do with parities and rounding down, but I honestly cannot figure it out myself.

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

    In addressing the question of why choosing $$$x$$$ as the average between the maximum ($$$b$$$) and minimum ($$$a$$$) values doesn't always yield the optimal result in problem C, it is essential to understand how the parity effects the calculations.

    We categorize the scenarios based on the parity of $$$a$$$, $$$b$$$, and $$$x$$$. By brute force, we identify eight possible parity combinations, but let's consider two illustrative examples:

    • When $$$a=2i$$$, $$$b=2j+1$$$ and $$$x=2k+1$$$, the difference is $$$\left\lfloor (b + x)/2\right\rfloor - \left\lfloor(a+x)/2\right\rfloor = j - i + 1$$$.

    • When $$$a=2i+1$$$, $$$b=2j$$$ and $$$x=2k+1$$$, the difference is $$$\left\lfloor (b + x)/2\right\rfloor - \left\lfloor(a+x)/2\right\rfloor = j - i - 1$$$.

    In the remaining six cases, the difference is $$$\left\lfloor (b + x)/2\right\rfloor - \left\lfloor(a+x)/2\right\rfloor = j - i$$$.

    The optimal strategy emerges from these calculations. Matching the parity of $$$x$$$ with $$$a$$$ tends to minimize the difference. This is because the difference doesn't depend on $$$k$$$ and different parity can lead to a larger difference when $$$a$$$ is even.

    Now, regarding your specific question, if $$$a=4i+1$$$ and $$$b=4j$$$, then choosing $$$x$$$ as the average, $$$x = \left\lfloor (a+b)/2\right\rfloor = 2(i + j) = 2k$$$, does not align with the optimal strategy. In this case, $$$x$$$ is even while $$$a$$$ is odd, and as we've established, matching their parities is crucial for optimality.

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

Why there's a tag of binary seach in problem D: although it seems at first glance that we can go for a approach like BS. But then realised there's nothing to do with BS.

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

Thanks for the fast editorial !

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

    DEAR LORD! THOSE HINTS FOR PROBLEM D SAVED A LOT. I personaly prefer not to see the solution rightaway, and when the editorial/tutorial does not have any hints, I feel like cheating while Upsolving. Thanks!!!!

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

For problem D, my after-contest solution only involved checking the first location, the last location, and the location with the monster that needs the most spell power to kill.

Submission: https://mirror.codeforces.com/contest/1901/submission/234308715

Is the test data weak, or is the strategy described above valid? Thanks.

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

In problem D, according to my understanding the worst case for 2 1 5 6 4 3 should be 2->1->5->6->4->3 and that would not be possible with 8 damage ?

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

nvm I set my dp = -1 if it's not visited but I forget that the dp might be negative

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

in problem e why didn't we use re rooting how are we sure every root will give the same answer ?