Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void validateEdges() {
- int[] position = new int[k];
- Arrays.fill(position, s);
- for (int i = 0; i < days; i++) {
- ships.clear();
- for (int j = 0; j < k; j++) {
- for (Edge edge : g.get(position[j]).edges){
- if (edge.flow >= 1) {
- edge.flow -= 1;
- if (position[j] + n != edge.to) {
- ships.add(new Pair(j, edge.to % n));
- }
- position[j] = edge.to;
- break;
- }
- }
- }
- System.out.print(ships.size() + " ");
- for (Pair ship : ships) {
- System.out.print(ship.first + 1 + " " + (ship.second + 1) + " ");
- }
- System.out.println();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement