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

Автор maroonrk, история, 4 года назад, По-английски

We will hold AtCoder Regular Contest 147.

The point values will be 300-500-600-700-800-1100.

We are looking forward to your participation!

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

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

As one of the Writers, I hope all participants enjoy the contest. Good luck!

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

As one of the writers, good luck and have fun!

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

But there might be a small problem of time,becase COMPFEST 14 — Preliminary Online Mirror will begin at 21:35(UTC+8 for me)

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

Does anyone see the tasks?

»
4 года назад, скрыть # |
Rev. 3  
Проголосовать: нравится -164 Проголосовать: не нравится
Spoiler
»
4 года назад, скрыть # |
 
Проголосовать: нравится +11 Проголосовать: не нравится

Is problem E a famous problem ? djq_fpc solved it in 10min ...

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

great problems

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

Idk why but problems A and B felt very familiar to me. I even thought I opened some old contest by mistake.

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

Would anyone like to share more details about problem C? I think I have reached the step that the distance between the leftmost point and rightmost point should be as small as possible, but could not figure out how to handle the other n-2 points.

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

I put two wrong submissions submission1 and submission2 together and got an accepted submission. Can someone provide a hack and put it in the after_contest_tests? Thanks a lot.

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

O((2N + Nlog₂N) ∙ 2log₂1e7) solution for C using a weird kind of Binary Search.

submission

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

In editorial of C, how to recursively calculate C?

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

    let i be the index for which minimum of R exist and j be the index for which maximum of L exists. If we do not consider those two then i and j will be not in the optimal solution. let A[i] = R[i] = minimum of all R and B[j] = L[j] = maximum of all L. assuming A[i] < B[j], all other k where k != i and k != j we can do x[k] — A[i] + B[j] — x[k] = B[j]-A[i]. so the cost = B[j] — A[i] + (N-2)*(B[j]-A[i]) + C = (N-1)*(B[j]-A[i]) + C

    Explanation of C: Now waht we need do is solve the same problem for all others except i and j that is to find the minimum of R and maximum of L for the indices k where k != i and k != j. This is C as far as i understood.

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

looking forward to some alternative solution to C.

the one in editorial is elegant but hard to come up with (

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

    You can use the fact that the answer is minimized when there is some $$$p$$$, all $$$x$$$ is placed as close to $$$p$$$ as possible. This can be proved by contradiction. To calculate the answer, consider rewrite the answer as $$$\sum\limits_{i=-\infty}^{\infty} ((\sum\limits_{j=1}^n[x_j\leq i])\cdot (\sum\limits_{j=1}^n[x_j \gt i]))$$$, then we can iterate over all possible $$$p$$$ and calculate the answer. You can also find that the answer is optimized when $$$p=L_i$$$ or $$$p=R_i$$$ or $$$p=R_i+1$$$ for some $$$i$$$, then the solution is $$$O(n\log n)$$$.

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

      thanks for sharing. i agree with your general idea, but i still don't understand the specific solution. especially your formula that i tried several ways to understand but none of them seems reasonable, it's a little strange for me(the square bracket is one reason and does $$$\cdot$$$ really mean multiply here?). also why we need to consider $$$R_i + 1$$$ ? what about others ?(maybe L-1?,etc)

      sorry that the question I ask might seem kind of stupid, hope for reply

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

        Consider the $$$x_i$$$ are coordinates on the number line. Then the original formula means the distance between all pairs of points. We consider all segments of length $$$1$$$ on the number line, say $$$[i,i+1]$$$, then the contribution of it to the original formula is the number of points to the left of $$$i$$$ multiplies the number of points to the right of $$$i+1$$$, which is the formula above.

        Actually I'm not sure what are the key values that $$$p$$$ will choose. During the contest I just implemented a solution run in $$$O(10^7)$$$, and I implemented the $$$O(n\log n)$$$ solution later. I picked keypoints based on changes in variables, so maybe some of $$$p=L_i, p=R_i,p=R_i+1$$$ are not necessary, but these must be sufficient.

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

Does anyone get why the reverse works in problem F editorial [2]? I tried calculating some cases and it works but it seems there is some intuitive explanation that cannot be found by the formulas.