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

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

We will hold AtCoder Beginner Contest 276.

The point values will be 100-200-300-400-500-500-600-600. We are looking forward to your participation!

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

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

Can anybody give some hints to solve G ?

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

    Try to enumerate a[n] , and look at the array b such that b[i]=a[i]-a[i-1] (a[0]=0).

    Sorry for my poor English.

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

In editorial for E, where does the number 6 come from?

Therefore, it is sufficient to inspect all (at most 6) pairs of different squares adjacent to the starting square to check if there is a path connecting those squares consisting only of road squares.

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

Alternative solution of E :

Lets store a color value for each vertex, initially $$$-1$$$.
Color the $$$4$$$ adjacent vertices of $$$S$$$ by $$$1,2,3,4$$$.
Then do one BFS.
Initially insert all $$$4$$$ adjacent vertices of $$$S$$$ in BFS queue.
If you reach vertex $$$(i,j)$$$ from $$$(x,y)$$$ :
— If $$$color[i][j]$$$ is $$$-1$$$, then assign it $$$color[x][y]$$$
— Else if $$$color[i][j]$$$ is not $$$-1$$$ and its also not equal to $$$color[x][y]$$$, then we can reach one adjacent vertex of $$$S$$$ from another. Set the answer to "Yes"

Accepted Code

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

    I did the same. I used 'n', 'w', 's', 'e' instead of 1 2 3 4. Submission

  • »
    »
    20 месяцев назад, # ^ |
    Rev. 2   Проголосовать: нравится +1 Проголосовать: не нравится

    There's another solution in which we directly find the cycle containing the start point and having maximum length. If its length is greater than 3, the answer is "yes", else "no". Simple DFS

  • »
    »
    20 месяцев назад, # ^ |
    Rev. 5   Проголосовать: нравится 0 Проголосовать: не нравится

    here. you don't consider the lenght of the cycle. please details, how it is work? **if the grid is : 1. #### 2. #..#
    3. #.S#
    4. ####

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

Is there any approach different from the editorial of problem G?