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

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

We will hold AtCoder Beginner Contest 213.physics0523

We are looking forward to your participation!

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

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

Why are there $$$8$$$ problems in recent ABCs?
UPD: please upvote the announcement (the contest deserves much more contribution than my comment lol)

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

In D, forgot that I had to sort my adjacency vector as well. Got two WA and kept waiting for like 20 minutes. My bad :") Still got it at the last minute, GG.

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

how to solve F? there's no editorial for it

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

How to solve F?

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

Any simpler way to solve F than suffix array?

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

    How to do it with a suffix array?

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

      Build the suffix array and LCP array.

      Now, let $$$pos[i]$$$ denote position of suffix starting at index $$$i$$$ in the suffix array. $$$ans[i]$$$ will be sum of minimums of all segments ending at position $$$pos[i]-1$$$ and sum of minimums of all segments starting at $$$pos[i]$$$ (in the LCP array). Also an additional $$$n-i$$$ for LCP with itself.

      To find minimums on segment, we can find next smaller and previous smaller elements in the LCP array and using them precalculate the contribution of each prefix and suffix in $$$O(n)$$$.

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

For Problem H I tried a very simple approach. For each node we have an array $$$ans$$$ with $$$T+1$$$ values counting the amount of paths with length $$$t$$$ to this node. I iterate $$$t$$$ from $$$0$$$ to $$$T-1$$$ and on each step I walk all paths from each node and update $$$ans[t+k]+=ans[t]*paths[k]$$$. This yields correct answers but obviously this is $$$O(MT^2)$$$ and gets TLE.

What is the intended solution here?

Edit: Editorial is out, it's Divide & Conquer with FFT. Guess it is time to learn FFT for me.

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

PLEASE MAKE ABC PROBLEMS E F G H EASIER !!! IT IS A "BEGINNER" CONTEST!!! (I know that it's my problem, but they are yellow, orange, and red difficulty)

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

    I think they are meant to be educational in a sense that you get to learn about advance techniques/data structures while solving them, and in many cases they tend to be easier (relatively) than the average problems that require such techniques/DS.

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

    I think it's not bad though: although you might not be able to solve them this time, the problems are very educational and you can learn to solve problems like them in the future.

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

Is LCP array well-known? Never heard of it and it came out of nowhere @ 500 points problem so...

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

Can anyone tell how to solve E?

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

Can any one suggest me why My Problem D Solution is giving RE.

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

Another solution for H:

Consider the naive dp,$$$f(u,i)=\sum_{e:(u,v)}\sum_t f(v,i-t)p(e,t)$$$

Let $$$F_u=\sum_{i=0}^T f(u,i)x^i$$$,then we have $$$n$$$ variables(Polynomial) and $$$n$$$ equation. They are polynomials,so we can't use gauss's method directedly.

let's take $$$L(L\ge n,L=2^k)$$$ roots of unity,$$$\omega_L^0,\omega_L^1..\omega_L^{L-1}$$$,replace $$$F_u$$$ with $$$F_u(\omega _L^k)$$$ for $$$k\in [0,L)$$$,and do gauss's method for them.

then do IDFT to calculate the polynomials for the $$$L$$$ points values.

$$$O(Tn^3+T\log T n)$$$

update: it's wrong,see the comments below to see reasons.

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

    Also,we could solve problem G in $$$O(2^nn^2)$$$,by subset convolution.

    My code

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

    If I understood correctly, by

    we have $$$n$$$ variables(Polynomial) and $$$n$$$ equation

    you mean equations like $$$F_u = \sum \limits_{e : (u, v)} F_v \cdot p(e)$$$. These equations do not hold because the degree of LHS is $$$T$$$ but degree of the RHS is $$$2T$$$.

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

      Oh yes,it's wrong.

      I want the equations hold $$$\mod x^{T+1}$$$,but if take $$$\omega_L^0...\omega_L^{L-1}$$$,the equations hold $$$\mod (x^{T+1}-1)$$$ (don't take mod,the roots exist,but may have infinity degree,so the results after taking mod are not the same.)

      Thanks a lot for pointing out my mistakes.