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

Автор chokudai, история, 6 лет назад, По-английски

We will hold Japanese Student Championship 2021.

Everyone is welcome to participate. Please note that this contest will be held at a different time than usual.

The point values will be 100-200-300-400-500-600-600-600.

We are looking forward to your participation!

  • Проголосовать: нравится
  • +58
  • Проголосовать: не нравится

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

:)  Does anybody have any idea what could be test case 57 in probem E?

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

Can anybody please share their data structure implementation for problem F.

In the editorial, it is written that we need a data structure with following capabilities:

  • manage the set of numbers
  • support removing and adding numbers
  • find the number of elements less than a specified value
  • find the sum of elements greater than a specified value

By the problem constraints, we need to implement all of it in at most O(logn).

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

Edit: I found my problem while writing this here down. I returned "-1" to indicate impossible, but I still was adding the changes from combining odd-lenghted palindromes. Stupid me. That's what you get from abusing signed integers and giving negative values special meaning.


In Problem E I am able to solve (nearly) all cases, the cases 48-52 (the ones labeled "impossible") give me WA. I implemented and algorithm that recursivly splits the string in its substrings. Impossible can happen if:

  • At level 0 we have only 1 character left. This one mustn't be a palindrome, but since it only has 1 character, it is a palindrome. So it is impossible.

  • At some level L>0 we have 0 characters left. A Level L>0 palindrome must have at least 1 character. It is impossible.

What am I missing? (Edit: I was missing nothing.)

My submission: https://atcoder.jp/contests/jsc2021/submissions/21832753

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

In problem F acc. to solution: One can use a self-balancing binary search tree, but it can alternatively be solved with coordinates compression and segment trees. can anyone help me out on how to proceed with the second approach?

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

    I'm also still thinking about this, about both approaches. My thoughts about the second approach up to now are:

    • Preprocess all the Queries and collect all Values $$$Y_i$$$
    • Build a segment Tree, with sorted $$$Y_i$$$ values as leaves.
    • In the Beginning all leaves in the tree are "deactiviated".
    • start processing the Queries for real now.
    • Reading in a $$$Y_i$$$ activates it in the segment Tree. The tree has to be updated in regards to "Number of elements smaller than some $$$Y$$$" and "Sum of elements bigger than some $$$Y$$$"

    Of course you need to separate this between both trees. I'm still not sure about the details though, I will answer again when I have hopefully my own implementation.

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

Can any one tell me how to solve problem C , i am not getting it from editorial.

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

    Maybe another (similar) way to find a solution. (It helps to look at problems from different perspectives).

    Assume $$$m$$$ ist the maximum possible number, such that $$$gcd(x,y)=m$$$. Then $$$x-y \ge m$$$ since both of them are divisible by m. So $$$B-A \ge m$$$

    But now assume $$$m=B-A$$$. Then, in order to have $$$gcd(x,y)=m$$$ both $$$x$$$ and $$$y$$$ must be divisible by $$$m$$$. Since $$$x-y=m$$$ we must have $$$x\mod m=0$$$. If that ist not the case, we can try the nextsmaller $$$m$$$. What if $$$m=B-A-1$$$? Then either $$$x=A$$$ and $$$y=B-1$$$ or $$$x=A+1$$$ and $$$y=B$$$. So either $$$A \mod m =0$$$ or $$$A+1 \mod m =0$$$. If this does not work, what if $$$m=B-A-c$$$? We can notice a reccurence: We can find such $$$x$$$ and $$$y$$$ if $$$(A \mod m) + c \lt = A-B$$$. This we can check for all m descending (c increasing). It is always true for m=1 so it will terminate.