MaxBlazeIceInk's blog

By MaxBlazeIceInk, 86 minutes 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
  • +5
  • Vote: I do not like it

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

Too fast editorial! Tasks are soo good!

MaxBlazeIceInk please pin announcement and editorial to the contest page.

  • »
    »
    45 minutes ago, hide # ^ |
     
    Vote: I like it +6 Vote: I do not like it

    You stole my job! >:(

»
43 minutes 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
»
40 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

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

bad contest

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

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

»
35 minutes ago, hide # |
← Rev. 2  
Vote: I like it +5 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

»
34 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

»
31 minute(s) 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?

  • »
    »
    23 minutes ago, hide # ^ |
     
    Vote: I like it +1 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.

    • »
      »
      »
      19 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

      • »
        »
        »
        »
        4 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!"

  • »
    »
    22 minutes ago, hide # ^ |
    ← Rev. 2  
    Vote: I like it +1 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

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

      aaaa, thanks

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

      Can u explain ur thoughts process to solve this q

      • »
        »
        »
        »
        1 minute 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
  • »
    »
    22 minutes ago, hide # ^ |
     
    Vote: I like it 0 Vote: I do not like it

    we need 3rd maximum which is 3 in both cases

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

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

»
20 minutes ago, hide # |
 
Vote: I like it 0 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.