Блог пользователя Tigutor

Автор Tigutor, история, 5 лет назад, По-английски

Here is the statement https://wcipeg.com/problem/coi08p3

I found it very interesting, because restrictions are big. I was thinking about using array d[i] — number of cells with distance i to them, but I cannot recalculate it for one rectangle quickly.

So if you have any ideas, please share them

  • Проголосовать: нравится
  • +13
  • Проголосовать: не нравится

»
5 лет назад, скрыть # |
 
Проголосовать: нравится +13 Проголосовать: не нравится

Let $$$f_i(t)$$$ be the number of cells covered in the $$$i$$$-th sheet after $$$t$$$ minutes. It's easy to show that we can split the range $$$[0, \infty)$$$ into $$$O(1)$$$ ranges such that in each of these ranges, $$$f_i$$$ is a constant, linear or quadratic polynomial.

What the problem asks is the sum $$$f(t) = \sum_i f_i(t)$$$ for various values of $$$t$$$. Because each $$$f_i$$$ is a piecewise quadratic function with $$$O(1)$$$ pieces, $$$f$$$ is also a piecewise quadratic function with $$$O(n)$$$ pieces. You can calculate the coefficients of the polynomials in each of these pieces (by sweepline, for example) and evaluate a suitable function for each $$$t$$$ in the input.