MaxBlazeIceInk's blog

By MaxBlazeIceInk, 3 hours ago, In English

2272A - Maximize One MEX

Idea: yvbf, Preparation: yvbf

Solution
Code
Rate the Problem!

2272B - Frogs Jump

Idea: yvbf, Preparation: yvbf

Solution
Code
Rate the Problem!

2272C - Yet Another Black Cell Problem

Idea: yvbf, Preparation: MaxBlazeIceInk

Solution
Code
Rate the Problem!

2272D - Connecting the Conflicts

Idea: yvbf, Preparation: yvbf, MaxBlazeIceInk

Solution
Code
Rate the Problem!

2272E - Memory Cell Interception

Idea: yvbf, Preparation: MaxBlazeIceInk

Solution
Code
Rate the Problem!

2272F - Tree Reduction Game

Idea: JerrySyr, Preparation: JerrySyr

Hint1
Hint2
Hint3
Hint4
Solution
Code
Rate the Problem!

2272G - Ranges

Idea: MoScenix, Preparation: MoScenix

Solution
Code
Rate the Problem!
  • Vote: I like it
  • +3
  • Vote: I do not like it

»
2 hours ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

Too fast editorial! Tasks are soo good!

MaxBlazeIceInk please pin announcement and editorial to the contest page.

  • »
    »
    2 hours ago, hide # ^ |
     
    Vote: I like it +5 Vote: I do not like it

    You stole my job! >:(

»
2 hours ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

My Idea for F:

Let down[v] indicate that the position is losing for the player to move when the root is v and the previous root is its parent. Define up[v] similarly for the position coming from its parent.

By induction on the remaining branches, - down[v] is true exactly when deg(v) is even and none of its children has down true. - For a child v of u, up[v] is true exactly when deg(u) is even and none of the other neighbors of u sends a losing position toward u. For an initial root u, Bob can guarantee a victory precisely when deg(u) is even and no neighbor sends a losing position toward u.

Compute down in reverse traversal order and up in forward order. This gives all winning choices in linear time without recursion.

Code
»
119 minutes ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

A is a bit too hard for an A problem in div 2 I suppose so

»
117 minutes ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

bad contest

»
117 minutes ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

I was too weak, I didn't believe my solution for B :'(

»
114 minutes ago, hide # |
← Rev. 2  
Vote: I like it +7 Vote: I do not like it

Another way to solve D would be to use the following identities:

Maximum Independent Set = n — Minimum Vertex Cover

And since the graph given is a tree, we can use König's theorem (which works for all bipartite graphs):

Maximum Matching = Minimum Vertex Cover

Thus we can rewrite: Maximum Independent Set = n- Maximum Matching.

The problem transforms into minimizing the matching.

The matching is at least the sum of each tree’s own maximum matching. We reach that sum by connecting every other tree to the neighbor of a leaf in some tree with n >= 2: that vertex is covered by every maximum matching, and it stays that way after each connection, so no new edge increases the matching. If all trees are single vertices, any star works.

my code: https://codeforces.me/contest/2272/submission/396141747

»
113 minutes ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

for the 3rd i got stuck when we had to optimally use the x number of cells to lower down the k

»
110 minutes ago, hide # |
← Rev. 3  
Vote: I like it 0 Vote: I do not like it

I think A is not correct as solution and statement itself


5 3 0 2 1 4 3

it gives -1, BUT actually we can change 4 and 3 again and get the value

Before: 1 1 3 3 5 after: 1 1 3 4 5

3 > 1

What am i skipped?

  • »
    »
    102 minutes ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    Your mistake is that... I think you didn't even look at the examples. It doesn't output -1. It outputs 4 5, which means we should swap a[4] and a[5]. You're right that we need to change 4 and 3 (indices 4 and 5) to get the optimal answer.

    • »
      »
      »
      98 minutes ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      That exactly what am i asking. It shouldn't be -1, but script provided in editorial breaks on this, with output -1. I think i look at the examples with more attention

      • »
        »
        »
        »
        83 minutes ago, hide # ^ |
         
        Vote: I like it 0 Vote: I do not like it

        Wait, let's look closer at this test.

        For 5 3 and 0 2 1 4 3:

        • Original prefix MEXes are [1, 1, 3, 3, 5]. Sorted descending: [5, 3, 3, 1, 1]. The 3rd element ($$$k=3$$$) is 3.
        • If we swap indices 4 and 3 (4 and 3), the array becomes 0 2 1 3 4, and prefix MEXes become [1, 1, 3, 4, 5]. Sorted descending: [5, 4, 3, 1, 1]. The 3rd element ($$$k=3$$$) is still 3.

        Since the $$$k$$$-th value doesn't increase, we shouldn't perform any operation, so the correct output is -1. The author's solution is correct!"

  • »
    »
    101 minute(s) ago, hide # ^ |
    ← Rev. 2  
    Vote: I like it 0 Vote: I do not like it

    I think you are getting the question wrong, we have to select kth largest $$$f(i)$$$,not $$$f(k)$$$, which is $$$3$$$ in both cases so ans is $$$-1$$$

    I also did the same mistake initially

    • »
      »
      »
      97 minutes ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      aaaa, thanks

    • »
      »
      »
      93 minutes ago, hide # ^ |
       
      Vote: I like it 0 Vote: I do not like it

      Can u explain ur thoughts process to solve this q

      • »
        »
        »
        »
        80 minutes ago, hide # ^ |
         
        Vote: I like it 0 Vote: I do not like it

        Just bruteforce every possible swap

        Try every possible swap and for each swap:

        Spoiler
        • »
          »
          »
          »
          »
          71 minute(s) ago, hide # ^ |
           
          Vote: I like it 0 Vote: I do not like it

          Oh fair I thought there was some other smart approach, or a one without brute

          • »
            »
            »
            »
            »
            »
            56 minutes ago, hide # ^ |
            ← Rev. 2  
            Vote: I like it +1 Vote: I do not like it

            There is indeed a smarter idea to solve rather than brute force. Because this is a permutation, the MEX array is always non-decreasing. This means the k-th largest MEX is determined entirely by the prefix of length M = N-K+1.

            • The maximum possible MEX for this prefix is M.
            • If the current MEX of this prefix is already M, no swap can improve it (output -1).
            • If the current MEX is smaller (say, X), it means X is missing. To fix this, just swap X (which is somewhere on the right) with the maximum element currently inside the prefix. The maximum element is mathematically guaranteed to be >= M.
  • »
    »
    100 minutes ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    we need 3rd maximum which is 3 in both cases

»
105 minutes ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

You can solve B with bfs(pls dont do that)

»
99 minutes ago, hide # |
 
Vote: I like it +4 Vote: I do not like it

Problem G has almost no problem solving difficulty if you know https://usaco.guide/adv/offline-del?lang=cpp.

»
72 minutes ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

can anyone explain the B please

  • »
    »
    64 minutes ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    For the snallest 2x2 grid, even num of frogs will keep everything legal. Since every column has at least one feog, if the total num of frogs is even, u will always find exclusive sets of these 2X2 grids

»
67 minutes ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

second problem was real good it was all about thinking all possible cases and then u can clearly see that how only even and odd repetitions of 'f' matters!!

»
63 minutes ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Bonus: Solve problem B without the restriction that each column contains at least one frog.

»
54 minutes ago, hide # |
 
Vote: I like it +3 Vote: I do not like it

A-D are all very standard and uninteresting problems i cant lie :(

»
41 minute(s) ago, hide # |
 
Vote: I like it 0 Vote: I do not like it

Man think for noobs like me but appreciate everyone efforts!

»
10 minutes ago, hide # |
 
Vote: I like it +1 Vote: I do not like it

any alt sol for c?