- Supercomputer
The problem can be solved using a topological sort and a BFS. The topological sort is used to find the order in which the nodes should be visited in the BFS. The BFS is used to calculate the maximum number of switches.
- Ferate
The problem can be solved using Tarjan's algorithm for finding strongly connected components. The algorithm is used to find the number of strongly connected components and the number of edges that point to each component. The answer is the number of edges that point to the component with the most edges pointing to it.
- Teleportare
The problem can be solved using Dijkstra's algorithm. The algorithm is used to find the shortest path from the starting node to all the other nodes. The answer is the distance to the destination node.
- Magazin
The problem can be solved using a DFS. The DFS is used to find the order in which the nodes should be visited. The answer is the order in which the nodes are visited.