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

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

Can someone help me solving this problem Link problem statement is very simple

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

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

I think we need to make DAG with weights of edges 0/1. If u->v has weight 0 it means that a[v] >= a[u] + 0 and if u->v has weight 1 a[v] > a[i] (<=> a[v] >= a[u] + 1). If we have this graph it is easy to build the initial matrix. But i don't know how to build it and how to find out if there are no such graphs, so i also want to read the solution.