Soldier and Traveling

Source: Codeforces 546E

  1. Read the problem and summarise the task requirements.

Let’s try simple approaches.

  1. Attempt to design a greedy algorithm to solve the problem.
  2. Discuss why your algorithm was not correct.

What can we try when we want to correct mistakes in a greedy assignment?

  1. Build a flow network to represent the cities, roads and soldiers.
  2. Design an algorithm to solve the problem.

  3. Analyse the time complexity of your algorithm and estimate its running time.

  4. Implement this algorithm in code.
  5. Submit your program for judging!