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

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

We will hold AtCoder Regular Contest 153.

The point values will be 300-500-600-800-800-1000.

We are looking forward to your participation!

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

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

The whole 2 problems I read were both very good. How do you solve B?

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

    Congratulations um_nik pulling this 5 seconds before the end of the contest

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

    Note that for the operation $$$a\ b$$$, you can independently flip the indices for the height and the width respectively. So specifically, consider the first sample. We initially start with the indices $$$[0, 1, 2, 3, 4]$$$ for the height. When we apply the operation 3, we flip the first 3 and the last 2 to get $$$[2, 1, 0, 4, 3]$$$. You can verify that within each row, the original indices of each letter corresponds to this array, both the original position from the top and from the left.

    So the question is, can we compute these arrays for the height and width efficiently, and then we can just print out the result using these indices. The observation that we can make is that the operation flipping by $$$x$$$ is equivalent to

    1. rotating the index array right by $$$x$$$
    2. reversing the entire array

    We can also perform the reversal first, which gives us the equivalent set of instructions:

    1. reversing the entire array
    2. rotating the index array right by $$$len - x$$$ (where $$$len$$$ is either the height or width depending on which array it is)

    If we do two operations in a row, then we can do the reversals for both operations one right after the other, so they cancel out. So operation $$$x$$$ followed by operation $$$y$$$ is rotating right by $$$x$$$, then by $$$len - y$$$. We can do this to simulate an even number of operations, and if $$$Q$$$ is odd, we can just directly simulate the last step.

    Solution code can be found here.

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

    In C++ you can complete all reverse queries with __gnu_cxx::rope<int> in $$$O(log(n))$$$. My accepted solution.

    Reverse $$$[i,j)$$$ is equal to swap segment $$$[i,j)$$$ in direct order of items with segment $$$[n-j,n-i)$$$ in reversed order of items. The rope can erase and insert segments in $$$O(log(n))$$$.

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

    I treat a cell at $$$(1,1)$$$ as pivot point. By knowing the position of this pivot cell at the end, we can determine the rest of the positions

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

A binary version of problem D has appeared on codeforces before. Here is the link.

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

When Um_nik becomes rainboy

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

I felt like Problem B was standard. It is simply a straightforward implementation of Treaps. Sadly I don't have a pre-written template for treaps and wasted about an hour finding an easy-to-understand template for treap.

C seems nice.

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

How to solve Problem A?

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

Very nice problemset, thanks!

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

Why did everyone pass B with a splay?????? I feel humiliated.

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

I think many people solve B with data structures.

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

B was a nightmare for me

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

Editorial for problem C looks scary! https://atcoder.jp/contests/arc153/editorial/5523

I have another approach, is this correct?

WLOG, if A[0] = -1, flip the sign of A[i]. So A[0] is always positive.

Let S = sum of x[i] with A[i] positive, R = sum of x[i] with A[i] negative. Problem hence asks to find x[i] such that S = R and all x[i] distinct.

Initialize x[i] = i.

We have 2 cases. If S > R, then we can simply set x[i] = x[i] — (S-R).

If S < R, then for i = n-1 to 0, set x[i] = x[i] + (R-S). If by doing so, S == R at some point, stop here and we are done. If in the end S != R, then if sum of A[i] = 0, we know for sure there is no answer. Otherwise, reset x[i] = i, then for i = 0 to n-1, set x[i] = x[i] — (R-S) and stop when S = R.

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

    Your solution is correct (I implemented it and got AC). There are a couple of things I would like to say:

    1. We have 2 cases. If S > R, then we can simply set x[i] = x[i] — (S-R). This should be $$$x[0] = x[0] - (S - R)$$$, not $$$x[i] = x[i] - (S - R)$$$.

    2. If in the end S != R, then if sum of A[i] = 0, we know for sure there is no answer. This is true, but unnescessary. We can just check for answer in the other direction and if there still is no answer found, we print "No".

    3. When implementing the code, make sure to use long long instead of int, the integers will get very large.

    I won't link my code here, because it's messy and I don't want to spoil the implementation part for you. If you need any help, I'll be glad to help!

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

Can anyone tell what the problem ratings are Thanks.

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

    To view problem ratings, go to the ARC section here.

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

      What's rating 500 in relation to cf ratings? Specialist?

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

        I'm not 100% certain, but I heard from someone that approximately atcoder = cf — 200.

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

          If that's so then I think cf rating 1300 should solve Atcoder F-1000 ?

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

            i don't know for sure.. probably atcoder rating is a better proxy than cf rating

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

            1000 is F's score in contest, not its rating.

            Move the cursor over the circle before the problem title, you can see its difficulty (rating).