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

Автор yesnomaybe, история, 4 года назад, По-английски
  • Проголосовать: нравится
  • +1
  • Проголосовать: не нравится

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by yesnomaybe (previous revision, new revision, compare).

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Auto comment: topic has been updated by yesnomaybe (previous revision, new revision, compare).

»
4 года назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

You can interpret the tasks as nodes in a graph. There is a directed edge (because of the index restriction) $$$v \rightarrow u$$$ if $$$u$$$ can be completed immediately after $$$v$$$. Since there are $$$10^3$$$ tasks, the maximum number of edges is around $$$10^6$$$, which is fine.

The problem can be understood as "choosing the minimum number of directed paths such that you visit each vertex exactly once". I have seen this problem here and the only editorial I know of is this YouTube video.