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

Автор dfsof, история, 8 месяцев назад, По-английски

Orz.hardstone gives me four problems. However, I am so dumb that can only solve the easiest one:

First, we define $$$A$$$ as a non-negative integer array $$$A:=\{a_i\}$$$. We call $$$A$$$ is valid if $$$A$$$ is a [degree sequence](https://en.wikipedia.org/wiki/Degree_(graph_theory)) of a simple undirected graph.

P1: Give $$$A$$$, decide whether $$$A$$$ is valid. (Solved using Erdos-Gallai, $$$O(n)$$$);

P2: Give $$$A$$$ and $$$q$$$ independent queries $$$(l, r)$$$, decide whether $$$A[l...r]$$$ is valid.

P3: Give $$$A$$$, count how many continuous subarrays of $$$A$$$ are valid.

P4: Solve $$$P2$$$ if modification on $$$A$$$ is allowed.

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