Negate all edge weights to convert the problem.
Run Bellman-Ford from node for iterations.
Check for negative cycles using an -th iteration.
If a cycle exists, mark all nodes improved in the -th iteration.
Propagate the cycle effect using BFS to find all affected nodes.
Check if node is affected.
If yes, output . Otherwise, output -dist[n]. The core step is propagating cycle effects to all reachable nodes, not the nodes directly in the cycle.