Please read the new rule regarding the restriction on the use of AI tools. ×

Soldat's blog

By Soldat, 12 years ago, In Russian

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

  • Vote: I like it
  • +7
  • Vote: I do not like it

»
12 years ago, # |
Rev. 6   Vote: I like it +5 Vote: I do not like it

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)

»
12 years ago, # |
  Vote: I like it +6 Vote: I do not like it

Thank you very much