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

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

We will hold キーエンスプログラミングコンテスト2022(AtCoder Beginner Contest 274).

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

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

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

Excited to participate

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

What is the expert-equivalent rating on atcoder ?

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

Wish a good contest with all contestants

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

Why ABC's navbar is unusual red?

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

Not sure if it was intended, but C and D are very hard to understand problem statements. Actually I did not get C at all.

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

In problem D, the question could have been asked without the limitation of p2 = (A1,0).

Once this limitation is added, the question becomes even easier.

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

    I get it now. Without this limitation, one could put the first point on a place like (1,1) which is 45 degrees, then all subsequent points have to be a right angle to this 45 degrees angle. There will be floating points coordinates.

    The limitation could have been changed to "the first point must lie on the x-axis or the y-axis". Then there will be no floating points coordinates to worry about.

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

in problem D: why is this simple DP solution wrong? I don't seem to figure it out

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

    Note that you don't necessarily have to go positive direction in the y axis. You only have to go positive in the x axis.

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

      yes but if you notice the helper function I have made sure we're going in both direction in y-axis (cur+v[idx] and cur-v[idx]) while on the x-axis i've already made the first move on +ve x-axis (as the function starts with cur=v[0]) and then going both ways.

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

        I spent some time trying to understand your code and coming up with a counter example. Here is a smallest input on which your submission fails.

        5 -3 0
        0 0 1 0 2
        

        Your code outputs "No," but the answer is "Yes," because you can take two steps in the negative X direction.

        You are missing the fact that the dp table should have two indices: one denoting the coordinate, and other denoting the number of steps. What happens in the above example is (due to order of evaluation of an or of two boolean expression), you first take 1 step in X-direction, then you take 2 steps right, dp[3] gets set to 0, because 3 is not our target. Then you take 2 steps left, now this is the crucial point, you mark dp[-1] = 0! This is a mistake! Because after unrolling of the recursion, when you take 1 step to left from 0, you reach -1, and you check there is already a 0 stored at dp[-1], so you return a 0. The thing is dp[-1][0] should be 0, where the second index denotes the number of steps remaining.

        See, with two indices, it is accepted: link to submission (I used second index to be number of steps taken.)

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

What is test 20 of E about? Getting WA all the time.

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

Is there a sample code for G that doesn't use flows?

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

how to solve d?

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

    Given $$$a_1, a_2, a_3, a_4, a_5, a_6$$$, the problem could be simplified to

    $$$(-1)^{p_1}a_1 + (-1)^{p_3}a_3 + (-1)^{p_5}a_5 = x$$$
    $$$(-1)^{p_2}a_2 + (-1)^{p_4}a_4 + (-1)^{p_6}a_6 = y$$$

    You need to find out whether there is a sequence of $$$p_1, p_2, p_3, p_4, p_5, p_6$$$ so that both of these equations are satisfied.

    The easiest approach is to enumerate all of the $$$2^6 = 64$$$ combinations:

    # p1 p2 p3 p4 p5 p6
    1 $$$0$$$ $$$0$$$ $$$0$$$ $$$0$$$ $$$0$$$ $$$0$$$
    2 $$$0$$$ $$$0$$$ $$$0$$$ $$$0$$$ $$$0$$$ $$$1$$$
    3 $$$0$$$ $$$0$$$ $$$0$$$ $$$0$$$ $$$1$$$ $$$0$$$
    4 $$$0$$$ $$$0$$$ $$$0$$$ $$$0$$$ $$$1$$$ $$$1$$$
    5 $$$0$$$ $$$0$$$ $$$0$$$ $$$1$$$ $$$0$$$ $$$0$$$
    . . . . . . .
    64 $$$1$$$ $$$1$$$ $$$1$$$ $$$1$$$ $$$1$$$ $$$1$$$

    But if you actually try enumerating like that you will find out that you are often computing the same sum again and again. And this is an opportunity for an optimisation! =)

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

    I did Dynamic Programming

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

I amnot understanding one thing , why atcoder kept giving me wa verdict instead of runtime error when I am accessing invalid memory address

if it gave RE I would have debugged way sooner

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

I am still struggling with C.

In second example input array a={ 1, 3, 5, 2 }

So how do we calculate position, and from that, number of generations of say amoeba 4?

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

In the Editorial of problem E, it's mentioned that Even if M>0, we can solve it in the same way by “assuming treasure boxes as towns and allowing returning to the origin without visiting treasure boxes. But how are we taking care of the cases in which we visit a few treasure boxes multiple times because TSP won't allow revisiting nodes right?