10 1 4 -2 2 2 10 -1 2 7 1 1 3 6 -3 3 7 8 9 0 6 4 4 5 6 1 9 8 5 5 4 1 8 1 10 2 6 9 0 3 0 2 4 7 8 2 2 1 10 1 3 0 8 4 -2 7 3 5 3 9 10 7 3 4 6 6 10 5 1 7 2 1 3 9 -3 Initial arrays: 1 2 3 4 5 6 7 8 9 10 value: 0 * * * * * * * * * back: * * * * * * * * * * Arrays after 1 iteration of the main loop: 1 2 3 4 5 6 7 8 9 10 value: 0 2 * -2 * * * * * -1 back: * 1 * 1 * * * * * 1 Arrays after 2 iterations of the main loop: 1 2 3 4 5 6 7 8 9 10 value: 0 2 0 -2 0 -1 1 1 -4 -1 back: * 1 9 1 10 2 10 5 10 1 Arrays after 3 iterations of the main loop: 1 2 3 4 5 6 7 8 9 10 value: 0 2 -1 -2 0 -1 1 1 -4 -1 back: * 1 6 1 10 2 10 5 10 1 Shortest path to 1: 1: cost = 0 Shortest path to 2: 1 2: cost = 2 Shortest path to 3: 1 2 6 3: cost = -1 Shortest path to 4: 1 4: cost = -2 Shortest path to 5: 1 10 5: cost = 0 Shortest path to 6: 1 2 6: cost = -1 Shortest path to 7: 1 10 7: cost = 1 Shortest path to 8: 1 10 5 8: cost = 1 Shortest path to 9: 1 10 9: cost = -4 Shortest path to 10: 1 10: cost = -1