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

Автор Soldat, 13 лет назад, По-русски

Good day for everybody!!! Recently I found a very nice problem from NEERC 2003 about graphs. I don't have any ideas to solve. Thanks if anyone will write. problem B. Bring Them There http://neerc.ifmo.ru/past/2003/problems.pdf

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

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

Let it takes C days to deliver supercomputers. Use binary search to find it's value. To check "is it enough C days for deliver all K supercomputers" use maximum flow. The net looks like follows:
1) for each day i and each planet j there exist an edge from (i, j) to (i + 1, j) (space ship (or ships) stay at this particular solar system for one day)
2) for each day i, and two planets (x, y), if exists tunnel between x and y, there is an edge from vertex (i, x) to (i + 1, y) and the edge from (i, y) to (i + 1, x) (the capacity of both edges is 1 unit).
If value of maximum flow from (0, S) to (C, T) is bigger than or equal K, we can deliver K supercomputers for C days.
To avoid ships to move in opposite directions using the same tunnel, you can use additional edge for each pair of edges from 2).

A = new vertex(), B = new Vertex();
addEdge(Vertex(i, x), A, 1);
addEdge(Vertex(i, y), A, 1);
addEdge(A, B, 1);
addEdge(B, Vertex(i + 1, x), 1);
addEdge(B, Vertex(i + 1, y), 1);


It can be implemented without using additional edges. It is not necessarily if first edge to check in your DFS is edge from 1)

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

Thank you very much