Doubt with IOI'19: Split the Attractions

Revision en2, by PathToMaster, 2020-09-03 20:26:34

Hi! I was trying to solve that problem but it gave me WA on subtask 3. Reading the official solution, I realized that it was pretty similar to what I did, but verifying that the two components have a size more than a. I verified that the remaining component (the one not used to assign vertices to A) had a size more than or equal to b.

Could someone tell me why the solution works? I just don't get it. Logically speaking (or writing lol), it would be impossible to assign b vertices from a subgraph of size less than b.

Update: Thinking very much, I realized why it works. Please correct me if I am wrong. If the size of the remaining component is greater or equal to a and lower than b, then we can use such component to assign vertices to A and the "original" one to assign vertices to B, because the size of the original component is greater than (a+b+c)-b = (a+c) >= b (remember b <= c so b <= a+c).


  Rev. Lang. By When Δ Comment
en2 English PathToMaster 2020-09-03 20:26:34 411 Tiny change: 'n `b`.\n\nUpdate: Thinking' -> 'n `b`.\n\n**Update**: Thinking'
en1 English PathToMaster 2020-09-02 20:02:27 568 Initial revision (published)