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

Автор eren__, 19 часов назад, По-английски

⭐ Hope you enjoyed the problems! ⭐

2269A - SauSaGe Bank

Idea: Hamed_Ghaffari
Preparation: Hamed_Ghaffari

Hints
Solution
Code

2269B - KiaKio and Squared Numbers

Idea: sweetweasel
Preparation: sweetweasel

Hints
Solution
Code

2269C - K Is Important / 2268A - K Is Important

Idea: eren__
Preparation: eren__

Hints
Solution
Code

2269D - What a SauSaGe! It's All Meat / 2268B - What a SauSaGe! It's All Meat

Idea: _R00T
Preparation: _R00T

Hints
Solution
Code

2269E - KiaKio and Energy Intervals / 2268C - KiaKio and Energy Intervals

Idea: sweetweasel
Preparation: sweetweasel

Hints
Solution
Code

2269F - AghaBalaSar and Hamed / 2268D - AghaBalaSar and Hamed

Idea: Hamed_Ghaffari
Preparation: Hamed_Ghaffari

What is AghaBalaSar?
Hints
Solution
Code

2268E - Kia Kio and Tree of Life

Idea: sweetweasel
Preparation: Hamed_Ghaffari and _R00T

Hints
Solution
Code

2268F - Deglado

Idea: eren__
Preparation: Hamed_Ghaffari and _R00T

Hints
Solution
Code
Challenge
  • Проголосовать: нравится
  • +8
  • Проголосовать: не нравится

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

The gap between D and E is very huge, as 1400 to 2300.

And why $$$O(n^2)$$$ or $$$O(n\log^3n)$$$ can pass E's system test ?????????

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

In Hint 2 of the editorial for 1F, I believe you meant '2n*comb(2n, 2) inversions in the worst case', rather than 'n*comb(2n, 2)'.

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

E feels soooo hard

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

In problem D you can also generate the set of possible values and check if the array value belongs to the set or not

Code

PS: I'm sure there are better ways to calculate the set but this seemed to work so why not :)

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

I feel like another solution of D2D/D1B should be mentioned, making the problem not as ad-hoc (and I think that the fact that xor basis of $$$3k$$$ generates exactly all masks with even popcount is a prime example ad-hoc, because it works up to 4 bits).

The solution is as follows: let's do segment tree, and in each node we'll store $$$dp[start][end]$$$ — maximum number of positions on the interval of the node, if we also xor the first element with value $$$start$$$ and the last element $$$end$$$, these operations cover out-of-bounds elements. Then to merge two nodes we actually need to do matrix multiplication, but with operations $$$(\max, +)$$$: $$$dp[s][e] = \max_t dpl[s][t] + dpr[t][e]$$$. The answer is $$$dp[0][0]$$$ in the root node. This solution works in $$$O(16^3 \log n)$$$, which is a lot. But, maybe not every value of xor can be achieved, if we precalc the set of possible values, we get $$$0,3,5,6,9,10,12,15$$$ — $$$8$$$ elements istead of $$$16$$$. Now matrix multiplication takes $$$8^3$$$ operations and the solution passes.