Tutorial is loading...

Tutorial is loading...

Tutorial is loading...

Tutorial is loading...

Tutorial is loading...

Tutorial is loading...

Tutorial is loading...

# | User | Rating |
---|---|---|

1 | tourist | 3496 |

2 | moejy0viiiiiv | 3288 |

3 | W4yneb0t | 3218 |

4 | TakanashiRikka | 3178 |

5 | Petr | 3173 |

6 | dotorya | 3117 |

7 | izrak | 3109 |

7 | Um_nik | 3109 |

9 | anta | 3106 |

10 | ershov.stanislav | 3105 |

# | User | Contrib. |
---|---|---|

1 | rng_58 | 174 |

2 | csacademy | 169 |

3 | Swistakk | 160 |

4 | tourist | 157 |

4 | Petr | 157 |

6 | Errichto | 154 |

7 | Zlobober | 147 |

8 | matthew99 | 142 |

9 | Endagorion | 141 |

10 | BledDest | 134 |

Tutorial is loading...

Tutorial is loading...

Tutorial is loading...

Tutorial is loading...

Tutorial is loading...

Tutorial is loading...

Tutorial is loading...

Tutorial of Educational Codeforces Round 32

↑

↓

Codeforces (c) Copyright 2010-2017 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Nov/21/2017 03:49:57 (c4).

Desktop version, switch to mobile version.

User lists

Name |
---|

I liked this round. Generally, the idea of educational rounds is very good. That one in particular expanded my horizons. Usually, when you learn MST, you think: "Why should I bother with Prim's or Boruvka's algo? Just learn Kruskal and forget about the rest". Task G reminds us that every algorithm is important and can have its own unique application.

Before this round, I didn't even know about the existence of Boruvka's algorithm.

Neither did I.

Educational Rounds always teach us about some cool new algorithm or an application of an old algorithm that is not quite popular. :-)

FWIW, you can solve this by starting with Kruskal's algorithm too. If you only look at the highest bit at

b= 29, and split your vertex set into two halvesV_{0}andV_{1}(one with all vertices where bitbis turned on, the other all the vertices where this bit is turned off). It follows that internal edges in eitherV_{0}orV_{1}will have bitbturned off, but edges between the two components will have this bit turned on. Thus, if you were to run Kruskal's algorithm you would first enumerate all internal edges inV_{0}andV_{1}before considering edges between the two components. It follows that Kruskal's algorithm would first connect all ofV_{0}into a single tree (V_{1}respectively), and then find a single connecting edge between the two components.This gives you a simple recursive algorithm: Split on the highest order bit

b, solve these two halves recursively (only considering bits <b), and then find the weight of the single connecting edge, i.e. given two sequences of values, find the pair of values with minimal exclusive-or. This last problem can be solved using a very similar recursion.Code: 32170476

Hey guys! Here are some of my thoughts on the meet-in-the-middle techniques on problem E: http://robezhang.blogspot.com/2017/11/meet-in-middle-technique-on-educational.html Feel free to ask questions and give suggestions!

It is a similar problem but makes it easier to understand this technique.

Here is another problem that is kind of similar: https://www.codechef.com/MAY17/problems/CHEFCODE

Wow cool! It is also a good problem!

Why don't you put your implemented codes with the tutorial?I think it will be helpful for many of us :)

For problem C can someone explain this part:

" Write down lengths of segments between two consecutive occurrences of this character, from the first occurrence to the start of the string and from the last to the end of the string."

Let k be the maximal length such that there exists segment of length k that doesn't include character c. You can take all the occurrences of character c and check where this segment can fit. Thus maximal distance between those occurrences and ends of the string will get you maximal k.

how the bitmask solution look like for Probelm E?

i think the bitmask is for easy iteration over all possible subsets. Suppose there are n elements then iterate over 0 to 2^n for all possible subset generation.

Look at my codes for the problem F. I wrote a solution using an algorithm Boruvki but unfortunately it got TLE. Even though my realization is not good as author might have expected to see, I think 2 seconds for the problem which has complexity of is (very) tight

Try first sorting numbers. I have no idea why it works, but I also had time limit with same solution and sorting the numbers mad code at least 2x faster.

Doesn't the Boruvka's algorithm work for graphs with distinct edge weights only? In the case of problem G, how is that guaranteed?

It is not guaranteed, hence the warning.

`but we should be careful to avoid adding edges that form cycles in MST`

Can anybody elaborate D? for m, 0<=m<=k, pi != i. isn't this a derangement? How can there be nCm ways to do this?