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

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

We will hold Keyence Programming Contest 2020.

The point values will be 100 — 200 — 400 — 700 — 900 — 1100.

We are looking forward to your participation!

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

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

I keep wanting to participate in these unrated (for me) contests, but I always oversleep or play a few too many AOEII games or just forget. Surely this time...

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

Is this contest at Div.2 difficulty?

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

is D bitmask DP??

if yes, where my solution is going wrong

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

how to solve 2nd ans 4th question??

In second question, i tried to store count of overlap for each i ,and later sort and remove maximum overlapped element ,but got WA.

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

how to solve question 2??

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

AC on F 3 minutes after the contest QAQ

Great round as always! I particularly liked D and F.

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

    Can you please explain D?

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

      When we reorder the elements, if the card that was initially at position $$$i$$$ is at position $$$j$$$, then it is red face up if $$$i \equiv j\ (\text{mod}\ 2)$$$, and otherwise blue face up. So we only care about the final order the cards end up in, not the sequence of swaps.

      The optimal way to get to a particular final order is to first make swaps to move the card that should be in the first position to the first position, then do the same for the second and so on.

      Therefore, we can do DP with states indicating the elements we have already used and the value the current sequence ends in. From any particular DP state, loop all cards not yet used. The $$$d$$$th not yet used card costs $$$d$$$ to use as the next element in the sequence, and we know which way up it would be, so we know whether it is larger than the previous one, and what value the new sequence would end in.

      After calculating the DP, just output the minimum DP value where all cards are used and the sequence ends in an arbitrary value.

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

      I just use easy implement.My code is easy to understand. https://atcoder.jp/contests/keyence2020/submissions/9573589

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

      My solution slightly differs from the ones present here. It doesn't use DP.

      After all the swaps, there will some cards with the red face up, others with the blue face. Iterate through all possible $$$2^{n}$$$ combinations. A particular combination is valid if we get an increasing sequence after a sequence of swaps. Cards with the red face up have to move an even distance to their final position while ones with the blue face move an odd distance.

      Iterate the cards from the left and greedily assign them the lowest available final position. If its not possible to do so, the combination is invalid. To calculate the minimum number of swaps to make this final sequence, simply calculate the number of inversions of the final sequence w.r.t the original sequence.

      Repeat the above procedure for all possible $$$2^n$$$ combinations. The minimum of all of them is the answer.

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

Do you have a solution?

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

Can someone give me the data of problem E 01-02. I've been WA for so long and I can't find what's wrong.

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

Why was Task C so much easier than B even though its 400 points ?

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

Testcases are uploaded. Please wait a bit for editorials.

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

I think I misinterpreted Problem B, for test case 2 1 5 10 5, shouldn't the answer be 2 as we had to exclude the end points? Can someone tell me why its 1, as we had to exclude the end points, the ranges come out to be [-3,5] and [6,14] and they aren't intersecting.

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

Could someone share their approach for E?

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

    Main ideas:

    1. If two adjacent vertices $$$u$$$ and $$$v$$$ have $$$D_u = D_v$$$, it's possible to satisfy both by putting weight $$$D_u$$$ on the edge between them and giving the vertices opposite colors.
    2. If two adjacent vertices $$$u$$$ and $$$v$$$ have $$$D_u \lt D_v$$$, it's possible to satisfy $$$v$$$ by putting weight $$$D_v - D_u$$$ on the edge between them and giving the vertices the same color.
    3. If a vertex $$$v$$$ has no neighbor $$$u$$$ with $$$D_u \leq D_v$$$, it's not possible to satisfy $$$v$$$.

    If no vertex violates (3), it's always possible to construct a valid coloring and weight assignment using (1) and (2). Implementation is straightforward if vertices are processed in non-decreasing order of $$$D$$$. Unused edges can be assigned a weight of $$$10^9$$$.

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

In problem B, why do we have to sort according to x+l and not x-l?

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

How to solve F?

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

    We can reduce the problem to the following: Suppose that the board is initially uncolored. If exactly $$$i$$$ rows and $$$j$$$ columns are never chosen, then how many possible ways are there to color the grid? Either $$$i=j=0$$$ or $$$i,j \gt 0.$$$

    A way to color the grid is valid if we can repeatedly remove rows or columns in which all of the squares are the same color until only uncolored squares are left. Call rows and columns that may be removed uniform. To count each such grid exactly once, we should specify an order in which uniform rows and columns should be removed.

    • Step 1: Remove all uniform columns.
    • Step 2: Remove all uniform rows.
    • Step 3: Remove all uniform columns created by the removal of the rows in step 2.
    • ... and so on.

    Let $$$d$$$ be the number of distinct colors among the uniform rows or columns removed in the $$$i$$$-th step. It can be shown that $$$d$$$ is non-increasing over time (ignoring step 1). Furthermore, the number of ways to remove rows/columns on the $$$i+1$$$-st step depends only on $$$d$$$ after the $$$i$$$-th step and the number of rows/columns remaining.

    For example, if only black rows were removed during step 2 ($$$d=1$$$), then no black columns can be removed during step 3, because they were already removed during step 1. This means that $$$d$$$ will still equal one for step 3 (unless no columns are removed at all). Note that when $$$x=y=0$$$, $$$d$$$ is equal to two after every step (again, ignoring step 1).

    Code

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

Is there the tutorial in English?