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

Автор atcoder_official, история, 21 месяц назад, По-английски

We will hold AtCoder Beginner Contest 366.

We are looking forward to your participation!

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

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

Hope to solve A-F for me... anyways good luck for everybody!

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

Good luck and have fun!

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

Disclaimer: contest has ended.

What is the intended time complexity for F? $$$O(N\log N+NM)$$$ TLEs for F, but isn't $$$NM$$$ at most $$$2\times10^6$$$?

Edit: The intended time complexity for F is $$$O(N\log N+NM)$$$, but why does this not pass? Thanks

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

Hardest contest and my worst performance in a while. Failed to solve E and F.

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

I felt like giving up after e

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

    how to solve e

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

      Think it like this. We want to find center of N points on grid. How to find center of the N points on grid ? ( please find leet code question for the same, I remember solving one question on leet code , Keep in mind , there can be multiple center's of N points )

      To find the center sort all the 'x' cordinates, and sort all the 'y' coordinates and then find median of each one of them. Now, from center we can move some points to left, and some points to right. for that I had used binary search, I found few linear solution as well. I couldn't do it in linear time.

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

Can anybody "hack" this solution for F:

  1. Sort pairs $$$(A_i, B_i)$$$.

  2. Take the largest $$$X$$$ elements from them. I selected $$$X = min(N, 17)$$$.

  3. Check every possible variants of $$$K$$$ elements from $$$X$$$ elements — the regular $$$O(X * 2^X)$$$.

Accepted submission: 56571044

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

$$$O(N + M + D)$$$ amortized solution for E (well I also use sorting to find median of $$$y$$$-coordinates, but that's it, you could use k-th order statistic or median of medians if you really want)

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

    You mean E right? Can you give some hints

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

      One of the steps is similar to Japanese video editorial: if you fix coordinate $$$X_i$$$ you just need to find the interval $$$[Y_l, Y_h]$$$ in which points will not have sum of distances greater than $$$D$$$.

      For a fixed $$$X_i$$$ you can find sum of differences of $$$X$$$ coordinates in $$$O(1)$$$ with prefix sums.

      Now, all good points will lie in some kind of a "diamond" shape, and as you go over all $$$X$$$ coordinates from left to right this interval $$$[Y_l, Y_h]$$$ will first be increasing, then decreasing (or it could also be empty all the time).

      For any coordinate $$$X$$$ the best point is median of $$$Y$$$ coordinates, because it minimizes the difference for all $$$Y_i$$$. At this point you could just binary search both $$$Y_l$$$ and $$$Y_h$$$ up to this median value.

      However, since interval $$$[Y_l, Y_h]$$$ is first increasing, then decreasing, you can just do kind of a two-pointer approach, in total you will move both low and high pointers at most $$$3 \cdot (M + D)$$$ times.

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

Can anyone please help me how did we reach the conclusion in problem F : If (Ai — 1)/Bi > (Aj — 1)/Bj, then fi(fj(x)) > fj(fi(x)) ?

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

This comment has been deleted.