CF1804F Approximate Diameter
Description
Jack plans to consecutively apply $ q $ updates to his graph. Each update adds exactly one edge to the graph. Denote as $ G\_i $ the graph after exactly $ i $ updates are made. Jack wants to calculate $ q + 1 $ values $ d(G\_0), d(G\_1), d(G\_2), \\ldots, d(G\_q) $ .
However, Jack suspects that finding the exact diameters of $ q + 1 $ graphs might be a difficult task, so he is fine with approximate answers that differ from the correct answers no more than twice. Formally, Jack wants to find a sequence of positive integers $ a\_0, a\_1, a\_2, \\ldots, a\_q $ such that $ $ \left\lceil \frac{d(G_i)}{2} \right\rceil \le a_i \le 2 \cdot d(G_i) $ $ for each $ i$$$. Hacks You cannot make hacks in this problem.