Soldier and Traveling
Source: Codeforces 546E
- Read the problem and summarise the task requirements.
- Try to keep your response to a couple of sentences.
Let’s try simple approaches.
- Attempt to design a greedy algorithm to solve the problem.
- Reflector:
- Design a counterexample to the proposed algorithm.
- Discuss why your algorithm was not correct.
What can we try when we want to correct mistakes in a greedy assignment?
- Build a flow network to represent the cities, roads and soldiers.
- Are the existing cities and roads sufficient? Why or why not?
Design an algorithm to solve the problem.
Analyse the time complexity of your algorithm and estimate its running time.
- Implement this algorithm in code.
- Reflector:
- What potential pitfalls can you think of?
- Write some tests to check for these pitfalls.
- Other group members:
- Write a program which solves the problem.
- Run your tests and debug if necessary.
- Submit your program for judging!