Изменения рейтингов за последние раунды временно удалены. Скоро они будут возвращены. ×

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

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

Задача A:

Разбор
Код

Задача B (Автор: TheScrasse):

Разбор
Код

Задача C:

Разбор
Код

Задача D (Автор: sunkuangzheng):

Разбор
Код

Задача E:

Разбор
Код

Задача F (Автор: Vladithur):

Разбор
Код
Разбор задач Codeforces Round 1099 (Div. 2)
  • Проголосовать: нравится
  • +11
  • Проголосовать: не нравится

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

For problem C it says the Time Limit is 2 sec for every test, however in my solution I iterate over $$$N(\le10^5)$$$ and for each iteration I simulate the crunching procedure, $$$a_i$$$ which can go upto $$$10^9$$$ in worst case, and will take only $$$2log(H)\times(log(N\times(log(H)))$$$ ops, $$$2log(H)$$$ out of it are simulation steps and $$$(log(N\times(log(H))$$$ is the number of ops needed for updates in std::map, where $$$H(\le10^9)$$$, and the map size will be $$$N\times2log(H)$$$, so the time complexity should be $$$O(N\times2log(H)\times(log(N\times(log(H))))$$$, which translates to roughly $$$1.3\times10^8$$$ ops $$$\le$$$ $$$2\times10^8$$$ ops since Time Limit was 2 sec this shouldn't TLE.

Also Explanation for C in Edi isn't showing up.

xoxo and FairyWinx please look into the issues for 2231C - Chipmunk Theo and Equality

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

Решение за NlogC описанное в разборе не заходит даже на C++(почему то работает за 4169 мс) Причем я использовал unordered_set с самописными хешами, что log проевращало в O(1). Если что номер посылки 375550527

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

    Потому что обращение к мапе размера > $$$10^6$$$ — это уже очень долго, а у тебя таких обращений очень много. Оптимизация, что ты оставляешь в мапе только элементы, которые могут получены из первого элемента уже дает 500мс на питоне (да и асимптотика при использовании std::map составляет $$$O(n \cdot log(A) \cdot log(log(A))$$$

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

I have an interesting solution for C.

If we fix the parity of the final answer to be odd or even, then there is a greedy way to achieve it in minimum operations. Takes 203 ms only in Python

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

I have an interesting solution for C.

If we fix the parity of the final answer to be odd or even, then there is a greedy way to achieve it in minimum operations.

Takes 250 ms only in Python

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

I think it was a worst contest. The problem B (at least) is not a suitable one at all for the contest. Again perhaps the problem setting was not okey , isn't it?_

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

I think that it was a worst contest. Choosing problems for every position(specially for B) was really inappropriate , isn't it?

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

Problem C has quite an interesting TL Limit 375594227 had to optimise it to the bone with unordered_map (even multiple unordered_maps TLed) but somehow passed , preety much kept all possible elements and the cost required for each element to reduce to all elements they can reach and then found best answer among all values which all elements can be reduced to.

A more elegant solution i did during the contest 375535979 where i simulated from the largest value mentioning this as i have no clue what the tutorial has written. Hope it helps!!

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

Could someone recommend problems that use the same idea as F ? (Specifically the theorem mentioned)

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

I have an interesting solution for C. Construct a graph that represents the procedure mentioned in the problem. Like 9 -> 10 -> 5 -> 6 -> 3 -> 4 -> 2 -> 1. Imagine doing this for all natural numbers. The graph formed is almost a tree but it has an issue that there is an edge from 1 to 2 and also an edge from 2 to 1. So basically we can find the LCA(lowest common ancestor) of all the elements of the input array in this tree(assuming it's rooted at 1). And then we can calculate number of moves needed to reach this number(the LCA). Since there can be some trouble with 1 or 2. We check for 1 and 2 separately. Implementation

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

Can someone explain D? please.

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

approx how much would F be rated?

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

btw How much would approx F be rated??

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

how much would F be rated approximately

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

C makes us realize that we should not use map blindly. For instance, one could have used an array nd for each index store possible values instead of using map.