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

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

We will hold Caddi Programming Contest 2021(AtCoder Beginner Contest 193).

The point values will be 100-200-300-400-500-600.

We are looking forward to your participation!

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

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

OK, seems greedy is wrong for F....

What's the correct solution?

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

Couldn't catch the train till the end!

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

F, what strategy works, how to prove it?

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

    can't we do it via dp ?

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

      Most solutions I inspeced created a max flow graph.

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

        can you elaborate ?

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

          Let's suppose you had to minimize the number of adjacent pairs of cells with different colors. For a final coloring of the grid, this number can be calculated by dividing the nodes of the grid-graph (graph formed by adding edges among all pairs of cells which share a side) into 2 parts based on their colors and then counting the edges which connect nodes in different parts.

          To minimize this value, you can just find the minimum-cut of the graph. But you also have to ensure that cells that were already colored and had different colors are in different parts of the cut. For this, you can add an edge with infinity capacity from the source to each cell which is already colored black and from each cell which is already colored white to the sink. These edges can never be part of a minimum cut dividing source and sink and hence they will ensure that edges with fixed but different colors are in different parts.

          To solve the original problem, we will minimize the number of adjacent pairs of cells with same colors in a valid final coloring and subtract this value from the total number of edges in the grid graph. Notice that the endpoints of all edges in the grid graph have different value of (row no. + col no.) mod 2. So, if we flip the color of every node with (row no. + col no.) mod 2 == 0, then edges whose endpoints had different colors will now have same colors and vice-versa. This transformation reduces our problem to the problem discussed in the previous paragraphs which can be easily solved with Dinic's algorithm.

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

How to solve E and F?

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

I don't know why using doubles is giving WA in D!

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

I had some idea how to do F with Maximum Flow. But couldn't complete it. Anyone can share their approach?

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

For D, i used ll x=n-mp1[i]+mp2[i],y=n-mp2[j]+mp1[j]; instead of ll x=n-mp1[i]-mp2[i],y=n-mp2[j]-mp1[j]; . and tried to find the bug for 1 hour+. (: fuc* my luck (:

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

My usual screencast with explanations, but only A-E this time, sorry guys.

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

How do you solve C?

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

I have realized how powerful the AtCoder library it is... Look at this AC submission of E if you want to know reasons.

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

A more interesting ABC than usual. Kudos to problemsetters.

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

In problem F, how do I extract the chosen colors for all '?' cells (from the min-cut/max-flow)?