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

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

We will hold Sky Inc, Programming Contest 2023(AtCoder Beginner Contest 289).

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

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

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

Hi, atcoder contests are awesome. Thx you.

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

Why is there no Discuss tab on ABC's (linking to the codeforces blog)? even though ARC have them. It makes it harder to find the blogs otherwise.

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

    I agree with you, but they already share it there. But there is a situation like this: people usually join the atcoder to enter contests. There are no such things as problemsets, tags. That's why competitive programmers study from codeforces. 'here'. And people may forget to check atcoder.jp contest section. So they publish blogs here.

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

      I am not talking about a Discuss section built into atcoder. These blogs get lost after a while when new blogs come up and its hard to find a particular blog. ARC have a link built into the contest linking to the codeforces blog, so one can easily find the blog at a later time. I was asking why a similar thing is not done for ABC.

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

I debugged D for 15 minutes only to find out that the upper bound on N and M were different :(

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

Can someone tell me if G uses any harder concepts like FFT, etc. Or it can be solve using basic Data Structures and some observations.

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

    It uses something known as Li Chao Tree.
    After some playing with equations, G just boils down to this.

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

    Why would Beginner contest have FFT ? you are complicating even though I did not read question. I am guessing it

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

      yes it does (i meant past contests). atcoder beginner contest is not equivalent to a typical beginner contest. please view past atcoder contests for more reference.

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

      Usually F or G or Ex used to contain some advanced DSA but they used to be standard.

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

    it can be solved by basic math and basic STL: 38820861

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

    You can also just use divide and conquer.

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

      Thank you for that hint. I solved it using divide and conquer.
      Can you provide a link to your solution using divide and conquer?

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

How stupid am I!!!

For problem F I get AC in the last second.

To make debugging easier, I set limit=4 ($$$10^6$$$ in the original problem). And I forget to change it and get WA 3 times. After that, I find limit=4 is wrong and change it to limit=100000, and get another 3WA. Finally I realize that it should be limit=1000000 and get AC in the last minute: https://atcoder.jp/contests/abc289/submissions/38816912

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

    How lucky you are!

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

    How did you solved it?

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

      Even though I didn't solve F during the contest, I solved it afterwards. I solved for x axis and y axis seperetly. When I solved let's say for example for the x axis, I just run simple bfs, and checked if it's possible to reach $$$i^{th}$$$ coordinate in even or odd moves. And at the end I check if it's possible to reach both $$$t_x$$$ and $$$t_y$$$ in even or odd moves, and if the number of moves for some of them is smaller, then I just repeat any move twice to equalise the number of moves.

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

Found out solution of F but failed to AC within the contest time.

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

My week: "B is for Brick"

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

Can anyone explain how to solve E?

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

      I used BFS but I thought it wouldn't be so straightforward. So, I pre-computed all the valid transitions in advance. It turns out to be TLE. Then I moved on to try DFS and couldn't get it to work. I couldn't believe the most straightforward solution is a fast one in this case.

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

        I think it is just BFS on the tensor product of graph $$$G$$$, i.e., $$$G \otimes G$$$.

        I could debug your submission if you would like to.

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

          I got AC after moving the logic of looking for the next valid move inside the BFS queue.

          At first, I thought checking for the next valid move inside the BFS queue would be slower than pre-computing all the valid moves in advance.

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

            Yeah when expanding a node we should always check whether it is valid and it is visited before pushing it into the queue.

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

I have different approach for G

Let's say $$$B[1] \geq B[2] \geq ... \geq B[N]$$$ and $$$C[1] \leq C[2] \leq ... \leq C[M]$$$

$$$f(i, j) = (B[i] + C[j]) \cdot j$$$

We can notice that $$$ans[1] \leq ans[2] \leq ... \leq ans[M]$$$

I divided array into two halves, finding optimal $$$i$$$ for middle element, and recursively solved two halves with $$$opt \leq i$$$ and $$$opt \geq i$$$.

I think its complexity can be $$$O(nm)$$$, but it passes in 98 ms.

Can anyone please hack my solution: https://atcoder.jp/contests/abc289/submissions/38809712

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

It can hack this code:https://atcoder.jp/contests/abc289/submissions/38800008.

My friend read the problem by error.This code prints No with this test case.

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

Spent way too much time understanding B's statement. It's written badly and the weird formatting doesn't help either.

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

How to do C?

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

Just came here to point people to the beautiful codes A-F of jiangly. Link

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

any1 check the solution for G? for each j, use a ternary search to search the answer, and what we should do is:

find how many $$$i$$$ such that $$$a_i \ge x$$$.

which can be easily done by binary search. Time complexity is $$$O(m \log^2 n)$$$. Is it right?

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

    try doing what you said and printing out for every i. you'll see that it's not parabolic (it's a function of higher degree), so you can't use binary or ternary search

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

Can anyone explain solution of F? I can't find it anywhere.

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

Hello, I wonder when the test data will be available on dropbox?

It was so surprising to find abc289 absent on dropbox after sticking on 4 testcases in F for three hours.