erray's blog

By erray, 11 months ago, In English

The Problem

You are given a tree with $$$N$$$ ($$$1 \le N \le 10^5$$$) vertices.

You need to partition the vertices into minimum number of sets, such that every set has a maximum size of $$$S$$$ ($$$1 \le S \le N$$$) and maximum distance between any of the two vertices, that are in the same set is less than $$$2K$$$ ($$$1 \le K \le 20$$$).

With a more formal statement, assuming vertices in the tree are labeled $$$[1, N]$$$ and $$$dist(v, u)$$$ is defined as the distance between two vertices in the tree, you need to find a partition $$$ \{ P_0,\, P_1,\, \dots ,\, P_{C-1} \} $$$ with minimum $$$C$$$, such that:

  • for every $$$\displaystyle P_i, \ max_{\ \forall v,\ u \ \in P_i} \{dist(v, u)\} \le 2K$$$
  • for every $$$\displaystyle P_i, \ |P_i| \le S$$$
  • for every $$$\displaystyle 1 \le x \le N, \ x \in \bigcup P_i$$$

The problem doesn't want you to print the partition, you only need to print it's size (number of sets) and note that it's not necesseary for vertices in a set to form a connected component.

$$$ \ $$$

My manners
My ideas

Full text and comments »

  • Vote: I like it
  • +62
  • Vote: I do not like it

By erray, 3 years ago, In English

Hi everyone,

Our team selection test will be in a month probably and I'm bad at olympiad style competitive programming, I mean I'm bad at Codeforces style but olympiad style is the next level, I have no training and solved hardly any olympiad problems, according to my friends and blogs I have seen, problem styles can be very different, I looked up for the blogs like this and either they were old, or they had no information, so which problems should I solve, from which olympiads and assuming I get selected, how should I train for IOI ?

(Also please don't cyberbully me, I know my English is trash.)

Full text and comments »

  • Vote: I like it
  • +53
  • Vote: I do not like it